From ccc986f1d7d7d722fe97b0bfc2373ba2647ac9cc Mon Sep 17 00:00:00 2001 From: Chicken-Bomes Date: Fri, 19 Dec 2014 01:55:31 +1000 Subject: [PATCH] Fix ConcurrentModificationException in tile chunk load hook --- src/codechicken/lib/world/TileChunkLoadHook.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/codechicken/lib/world/TileChunkLoadHook.java b/src/codechicken/lib/world/TileChunkLoadHook.java index 718d45d..e080c2e 100644 --- a/src/codechicken/lib/world/TileChunkLoadHook.java +++ b/src/codechicken/lib/world/TileChunkLoadHook.java @@ -5,6 +5,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.ChunkEvent; +import java.util.ArrayList; +import java.util.List; + public class TileChunkLoadHook { private static boolean init; @@ -17,7 +20,8 @@ public class TileChunkLoadHook @SubscribeEvent public void onChunkLoad(ChunkEvent.Load event) { - for(TileEntity t : ((Iterable)event.getChunk().chunkTileEntityMap.values())) + List list = new ArrayList(event.getChunk().chunkTileEntityMap.values()); + for(TileEntity t : list) if(t instanceof IChunkLoadTile) ((IChunkLoadTile)t).onChunkLoad(); }