diff --git a/common/net/minecraftforge/common/ForgeChunkManager.java b/common/net/minecraftforge/common/ForgeChunkManager.java index 5145c2c18d..57274c83c1 100644 --- a/common/net/minecraftforge/common/ForgeChunkManager.java +++ b/common/net/minecraftforge/common/ForgeChunkManager.java @@ -880,7 +880,18 @@ public class ForgeChunkManager public static Chunk fetchDormantChunk(long coords, World world) { Cache cache = dormantChunkCache.get(world); - return cache == null ? null : cache.getIfPresent(coords); + Chunk chunk = cache.getIfPresent(coords); + if (chunk != null) + { + for (List eList : chunk.entityLists) + { + for (Entity e: eList) + { + e.resetEntityId(); + } + } + } + return chunk; } static void captureConfig(File configDir) diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 2e663e0ac3..a3fe8122b2 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -138,7 +138,7 @@ } public int func_82143_as() -@@ -2399,4 +2441,84 @@ +@@ -2399,4 +2441,92 @@ { return this.isBurning(); } @@ -221,5 +221,13 @@ + { + persistentID = UUID.randomUUID(); + } ++ } ++ ++ /** ++ * Reset the entity ID to a new value. Not to be used from Mod code ++ */ ++ public final void resetEntityId() ++ { ++ this.entityId = nextEntityID++; + } }