diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-08-04 11:57:51 +0100 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-08-08 18:30:57 +0100 |
commit | 47453c6055a0083f503ce6c98181c11f86d0fb77 (patch) | |
tree | b3d9cd2ba8eafd7284ce7958ed1eb2dda10c863b | |
parent | effc6c855934ab2d48bfc87f1984e541226af256 (diff) | |
download | craftbukkit-47453c6055a0083f503ce6c98181c11f86d0fb77.tar craftbukkit-47453c6055a0083f503ce6c98181c11f86d0fb77.tar.gz craftbukkit-47453c6055a0083f503ce6c98181c11f86d0fb77.tar.lz craftbukkit-47453c6055a0083f503ce6c98181c11f86d0fb77.tar.xz craftbukkit-47453c6055a0083f503ce6c98181c11f86d0fb77.zip |
Extremely experimental fix to the tile-entity wipe, thanks to Wug
-rw-r--r-- | src/main/java/net/minecraft/server/Chunk.java | 2 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/World.java | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index fdb28f4b..e44b9378 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -478,7 +478,7 @@ public class Chunk { while (iterator.hasNext()) { TileEntity tileentity = (TileEntity) iterator.next(); - tileentity.h(); + world.markForRemoval(tileentity); // Craftbukkit } for (int i = 0; i < this.entitySlices.length; ++i) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 63ea1588..f317fd22 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -89,6 +89,7 @@ public class World implements IBlockAccess { int lastXAccessed = Integer.MIN_VALUE; int lastZAccessed = Integer.MIN_VALUE; final Object chunkLock = new Object(); + private List<TileEntity> tileEntitiesToUnload; private boolean canSpawn(int x, int z) { if (this.generator != null) { @@ -106,10 +107,15 @@ public class World implements IBlockAccess { return (CraftServer) Bukkit.getServer(); } + public void markForRemoval(TileEntity tileentity) { + tileEntitiesToUnload.add(tileentity); + } + // CraftBukkit - changed signature public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider, ChunkGenerator gen, org.bukkit.World.Environment env) { this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); + tileEntitiesToUnload = new ArrayList<TileEntity>(); // CraftBukkit end this.Q = this.random.nextInt(12000); @@ -1137,6 +1143,14 @@ public class World implements IBlockAccess { } this.L = false; + + // Craftbukkit start + if (!tileEntitiesToUnload.isEmpty()) { + this.c.removeAll(tileEntitiesToUnload); + this.tileEntitiesToUnload.clear(); + } + // Craftbukkit end + if (!this.G.isEmpty()) { Iterator iterator1 = this.G.iterator(); |