Merge commit '695b080197bd577cc34fe6dbc72b74f4a74b2d5c' into snapshot15

Testing cherry picking.
This commit is contained in:
LexManos 2013-02-27 00:57:35 -08:00
parent 78e192e28e
commit a766603b38
3 changed files with 43 additions and 6 deletions

View file

@ -240,14 +240,28 @@ public class DimensionManager
*/
public static void unloadWorlds(Hashtable<Integer, long[]> worldTickTimes) {
for (int id : unloadQueue) {
WorldServer w = worlds.get(id);
try {
worlds.get(id).saveAllChunks(true, null);
if (w != null)
{
w.saveAllChunks(true, null);
}
else
{
FMLLog.warning("Unexpected world unload - world %d is already unloaded", id);
}
} catch (MinecraftException e) {
e.printStackTrace();
}
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(worlds.get(id)));
((WorldServer)worlds.get(id)).flush();
setWorld(id, null);
finally
{
if (w != null)
{
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(w));
w.flush();
setWorld(id, null);
}
}
}
unloadQueue.clear();
}

View file

@ -880,7 +880,22 @@ 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);
if (cache == null)
{
return null;
}
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)

View file

@ -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++;
+ }
}