summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2014-12-15 13:46:41 +0000
committerThinkofdeath <thinkofdeath@spigotmc.org>2014-12-15 13:46:41 +0000
commit28f37a113c57b56f3b6340712b74af6be0959ebc (patch)
tree56ab6c4a785a2f2a2521f9e296e052360dcf5b2e /src/main/java/org/bukkit
parentf6bfbb9851366ff22035cb3e8b5690bed449d739 (diff)
downloadcraftbukkit-28f37a113c57b56f3b6340712b74af6be0959ebc.tar
craftbukkit-28f37a113c57b56f3b6340712b74af6be0959ebc.tar.gz
craftbukkit-28f37a113c57b56f3b6340712b74af6be0959ebc.tar.lz
craftbukkit-28f37a113c57b56f3b6340712b74af6be0959ebc.tar.xz
craftbukkit-28f37a113c57b56f3b6340712b74af6be0959ebc.zip
Fix entities freezing when a chunk is regenerated
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index ad05e073..9d3be571 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -258,27 +258,29 @@ public class CraftWorld implements World {
return chunk != null;
}
- private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
+ private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int cx, int cz) {
if (chunk != null) {
- world.chunkProviderServer.chunks.put(LongHash.toLong(x, z), chunk);
+ world.chunkProviderServer.chunks.put(LongHash.toLong(cx, cz), chunk);
chunk.addEntities();
- if (!chunk.done && world.chunkProviderServer.isChunkLoaded(x + 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
- world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z);
- }
-
- if (world.chunkProviderServer.isChunkLoaded(x - 1, z) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z).done && world.chunkProviderServer.isChunkLoaded(x - 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
- world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z);
- }
+ // Update neighbor counts
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ if (x == 0 && z == 0) {
+ continue;
+ }
- if (world.chunkProviderServer.isChunkLoaded(x, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x, z - 1).done && world.chunkProviderServer.isChunkLoaded(x + 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
- world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z - 1);
+ net.minecraft.server.Chunk neighbor = world.chunkProviderServer.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
+ if (neighbor != null) {
+ neighbor.setNeighborLoaded(-x, -z);
+ chunk.setNeighborLoaded(x, z);
+ }
+ }
}
+ // CraftBukkit end
- if (world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z - 1).done && world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
- world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z - 1);
- }
+ chunk.loadNearby(world.chunkProviderServer, world.chunkProviderServer, cx, cz);
}
}