Vanilla/mod bug fixes: CME on entity processing, TileEntity resetting chunk on save/load.

This commit is contained in:
Christian 2012-10-29 17:41:08 -04:00
parent dd011e16d2
commit 01048c704b
6 changed files with 140 additions and 8 deletions

View file

@ -235,7 +235,10 @@ public class FMLCommonHandler
{
brd.add(forgeBranding);
}
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
if (sidedDelegate!=null)
{
brd.addAll(sidedDelegate.getAdditionalBrandingInformation());
}
try {
Properties props=new Properties();
props.load(getClass().getClassLoader().getResourceAsStream("fmlbranding.properties"));

View file

@ -71,15 +71,31 @@ public @interface Mod
String bukkitPlugin() default "";
/**
* Mods that this mod will <strong>not</strong> load with.
* An optional comma separated string of modid[@value], or the value - which specify mods that
* this mod will refuse to load with, resulting in the game failing to start. The special value - is
* interpreted as meaning <strong>all</strong> mods, except FML and MCP. The special value -f is
* interpreted as meaning <strong>all</strong> mods except FML, MCP and MinecraftForge.
* An optional comma separated string of (+|-)(*|modid[@value]) which specify mods that
* this mod will refuse to load with, resulting in the game failing to start.
* Entries can be prefixed with a + for a positive exclusion assertion, or - for a negative exclusion
* assertion. Asterisk is the wildcard and represents <strong>all</strong> mods.
*
* The <strong>only</strong> mods that cannot be excluded are FML and MCP, trivially.
* Other special values:
* <ul>
* <li>+f indicates that the mod will accept a minecraft forge environment.</li>
* <li>-* indicates that the mod will not accept any other mods.</li>
* </ul>
*
* Some examples:
* <ul>
* <li><em>-*,+f,+IronChest</em>: Will run only in a minecraft forge environment with the mod IronChests.
* The -* forces all mods to be excluded, then the +f and +IronChest add into the "allowed list".</li>
* <li><em>+f,-IC2</em>: Will run in a minecraft forge environment but will <strong>not</strong> run if
* IndustrialCraft 2 (IC2) is loaded alongside.</li>
* <li><em>-*</em>: Will not run if <strong>any</strong> othe mod is loaded except MCP/FML itself.</li>
* </ul>
*
* If a mod is present on the excluded list, the game will stop and show an error screen. If the
* class containing the {@link Mod} annotation has a "getCustomErrorException" method, it will be
* called to retrieve a custom error message for display in this case. If two mods have a declared
* exclusion which screen is shown is indeterminate.
* exclusion which is matched, the screen that is shown is indeterminate.
*
* @return A string listing modids to exclude from loading with this mod.
*/

View file

@ -0,0 +1,30 @@
--- ../src-base/common/net/minecraft/src/AnvilChunkLoader.java
+++ ../src-work/common/net/minecraft/src/AnvilChunkLoader.java
@@ -9,6 +9,9 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
+
+import cpw.mods.fml.common.FMLLog;
public class AnvilChunkLoader implements IThreadedFileIO, IChunkLoader
{
@@ -242,8 +245,15 @@
{
TileEntity var21 = (TileEntity)var17.next();
var10 = new NBTTagCompound();
- var21.func_70310_b(var10);
- var16.func_74742_a(var10);
+ try
+ {
+ 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());
+ }
}
p_75820_3_.func_74782_a("TileEntities", var16);

View file

@ -13,7 +13,7 @@
}
catch (Exception var4)
{
+ FMLLog.log(Level.SEVERE, var4, "A critical server error occured handling a packet, kicking %s", var2);
+ FMLLog.log(Level.SEVERE, var4, "A critical server error occured handling a packet, kicking %s", var2.getPlayer().field_70157_k);
field_71751_a.log(Level.WARNING, "Failed to handle packet: " + var4, var4);
var2.func_72565_c("Internal server error");
}

View file

@ -0,0 +1,44 @@
--- ../src-base/common/net/minecraft/src/TileEntity.java
+++ ../src-work/common/net/minecraft/src/TileEntity.java
@@ -1,9 +1,11 @@
package net.minecraft.src;
+import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.util.HashMap;
import java.util.Map;
+import java.util.logging.Level;
public class TileEntity
{
@@ -75,10 +77,10 @@
public static TileEntity func_70317_c(NBTTagCompound p_70317_0_)
{
TileEntity var1 = null;
-
+ Class var2 = null;
try
{
- Class var2 = (Class)field_70326_a.get(p_70317_0_.func_74779_i("id"));
+ var2 = (Class)field_70326_a.get(p_70317_0_.func_74779_i("id"));
if (var2 != null)
{
@@ -92,7 +94,15 @@
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());
+ var1 = null;
+ }
}
else
{

View file

@ -1,6 +1,45 @@
--- ../src-base/common/net/minecraft/src/World.java
+++ ../src-work/common/net/minecraft/src/World.java
@@ -3475,7 +3475,7 @@
@@ -10,6 +10,8 @@
import java.util.List;
import java.util.Random;
import java.util.Set;
+
+import com.google.common.collect.ImmutableList;
public abstract class World implements IBlockAccess
{
@@ -1552,8 +1554,9 @@
}
this.field_72984_F.func_76318_c("remove");
- 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);
+ Iterator var5 = fml_entitiesToRemove.iterator();
int var3;
int var4;
@@ -1569,7 +1572,7 @@
}
}
- var5 = this.field_72997_g.iterator();
+ var5 = fml_entitiesToRemove.iterator();
while (var5.hasNext())
{
@@ -1577,7 +1580,7 @@
this.func_72847_b(var2);
}
- this.field_72997_g.clear();
+ this.field_72997_g.removeAll(fml_entitiesToRemove);
this.field_72984_F.func_76318_c("regular");
for (var1 = 0; var1 < this.field_72996_f.size(); ++var1)
@@ -3475,7 +3478,7 @@
@SideOnly(Side.CLIENT)
public double func_72919_O()
{