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 01048c704b
commit 1bd53fe75f
4 files changed
+83 -13

No files matched your search

@@ -10,7 +10,29 @@
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();
var10 = new NBTTagCompound();
@@ -18,12 +40,14 @@
- var16.func_74742_a(var10);
+ try
+ {
+ var21.func_70310_b(var10);
+ var21.func_70310_b(var10);
+ var16.func_74742_a(var10);
+ }
+ 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,20 +25,22 @@
if (var2 != null)
{
@@ -92,7 +94,15 @@
@@ -92,7 +94,17 @@
if (var1 != null)
{
- var1.func_70307_a(p_70317_0_);
+ try
+ {
+ var1.func_70307_a(p_70317_0_);
+ }
+ 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());
+ try
+ {
+ var1.func_70307_a(p_70317_0_);
+ }
+ 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());
+ var1 = null;
+ }
+ }
}
else
{
@@ -16,7 +16,7 @@
- this.field_72996_f.removeAll(this.field_72997_g);
- Iterator var5 = this.field_72997_g.iterator();
+ List fml_entitiesToRemove = ImmutableList.copyOf(this.field_72997_g);
+ this.field_72996_f.removeAll(fml_entitiesToRemove);
+ this.field_72996_f.removeAll(fml_entitiesToRemove);
+ Iterator var5 = fml_entitiesToRemove.iterator();
int var3;
int var4;