Fix a potential problem with "Entity already added" when using the dormant

chunk cache capability. The entities in the dormant chunk cache will get new
IDs prior to the cached chunk returning.
This commit is contained in:
Christian committed 2013-01-25 21:21:20 -05:00
1 parent f20ea649c6
commit ae7e328228
2 files changed
+21 -2

No files matched your search

@@ -880,7 +880,18 @@ public class ForgeChunkManager
public static Chunk fetchDormantChunk(long coords, World world)
{
Cache<Long, Chunk> cache = dormantChunkCache.get(world);
return cache == null ? null : cache.getIfPresent(coords);
Chunk chunk = cache.getIfPresent(coords);
if (chunk != null)
{
for (List<Entity> eList : chunk.entityLists)
{
for (Entity e: eList)
{
e.resetEntityId();
}
}
}
return chunk;
}
static void captureConfig(File configDir)