Fix some whitespace issues, handle possibly bugged entities as well

This commit is contained in:
Christian committed 2012-10-30 09:13:18 -04:00
1 parent a7eb5dc773
commit a3a93f3387
3 files changed
+74 -4

No files matched your search

@@ -10,7 +10,29 @@
public class AnvilChunkLoader implements IThreadedFileIO, IChunkLoader public class AnvilChunkLoader implements IThreadedFileIO, IChunkLoader
{ {
@@ -242,8 +245,15 @@ @@ -227,9 +230,18 @@
p_75820_1_.field_76644_m = true;
var10 = new NBTTagCompound();
- if (var19.func_70039_c(var10))
- {
- var15.func_74742_a(var10);
+ try
+ {
+ if (var19.func_70039_c(var10))
+ {
+ var15.func_74742_a(var10);
+ }
+ }
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author",
+ var19.getClass().getName());
}
}
}
@@ -242,8 +254,17 @@
{ {
TileEntity var21 = (TileEntity)var17.next(); TileEntity var21 = (TileEntity)var17.next();
var10 = new NBTTagCompound(); var10 = new NBTTagCompound();
@@ -23,7 +45,9 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ FMLLog.log(Level.SEVERE, e, "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", var21.getClass().getName()); + FMLLog.log(Level.SEVERE, e,
+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author",
+ var21.getClass().getName());
+ } + }
} }
@@ -0,0 +1,44 @@
--- ../src-base/common/net/minecraft/src/EntityList.java
+++ ../src-work/common/net/minecraft/src/EntityList.java
@@ -3,6 +3,9 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.logging.Level;
+
+import cpw.mods.fml.common.FMLLog;
public class EntityList
{
@@ -52,10 +55,10 @@
public static Entity func_75615_a(NBTTagCompound p_75615_0_, World p_75615_1_)
{
Entity var2 = null;
-
+ Class var3 = null;
try
{
- Class var3 = (Class)field_75625_b.get(p_75615_0_.func_74779_i("id"));
+ var3 = (Class)field_75625_b.get(p_75615_0_.func_74779_i("id"));
if (var3 != null)
{
@@ -69,7 +72,17 @@
if (var2 != null)
{
- var2.func_70020_e(p_75615_0_);
+ try
+ {
+ var2.func_70020_e(p_75615_0_);
+ }
+ catch (Exception e)
+ {
+ FMLLog.log(Level.SEVERE, e,
+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_75615_0_.func_74779_i("id"), var3.getName());
+ var2 = null;
+ }
}
else
{
@@ -25,7 +25,7 @@
if (var2 != null) if (var2 != null)
{ {
@@ -92,7 +94,15 @@ @@ -92,7 +94,17 @@
if (var1 != null) if (var1 != null)
{ {
@@ -36,7 +36,9 @@
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ FMLLog.log(Level.SEVERE, e, "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", p_70317_0_.func_74779_i("id"), var2.getName()); + FMLLog.log(Level.SEVERE, e,
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_70317_0_.func_74779_i("id"), var2.getName());
+ var1 = null; + var1 = null;
+ } + }
} }