Fixed bad cast with That-Shall-Not-Be-Named by making damn sure the type of the

lists in World are of the proper type and creating the lists if they are not.
This commit is contained in:
ProfMobius committed 2015-03-25 19:43:58 +01:00
1 parent ede2d7f5b3
commit 5eb742e3d7
15 files changed
+85 -35

No files matched your search

@@ -15,6 +15,7 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import mcp.mobius.mobiuscore.profiler.ProfilerSection;
import mcp.mobius.opis.modOpis;
import mcp.mobius.opis.data.holders.basetypes.AmountHolder;
import mcp.mobius.opis.data.holders.basetypes.CoordinatesBlock;
import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
@@ -132,6 +133,14 @@ public enum EntityManager {
World world = DimensionManager.getWorld(dim);
if (world == null) continue;
if (!(world.loadedEntityList instanceof MonitoredEntityList)){
modOpis.log.info("Improper type detected for entity list in world " + dim + ". Regenerating tracking list.");
List<Entity> newList = new MonitoredEntityList<Entity>();
for (Object o : world.loadedEntityList)
newList.add((Entity)o);
world.loadedEntityList = newList;
}
Map<String, Integer> count = ((MonitoredEntityList)world.loadedEntityList).getCount();
for (String key : count.keySet())
if (count.get(key) > 0)