From 08740d7f91ab5a0f044439ab1212b75c15531355 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 4 Apr 2012 19:55:16 -0500 Subject: [PATCH] [Bleeding] Include chunk biome data for refresh chunk. Fixes BUKKIT-1166 --- .../net/minecraft/server/PlayerInstance.java | 2 +- .../org/bukkit/craftbukkit/CraftWorld.java | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java index 1c2ac79a22..671df47d74 100644 --- a/src/main/java/net/minecraft/server/PlayerInstance.java +++ b/src/main/java/net/minecraft/server/PlayerInstance.java @@ -114,7 +114,7 @@ class PlayerInstance { if (this.dirtyCount == 64) { i = this.chunkX * 16; j = this.chunkZ * 16; - this.sendAll(new Packet51MapChunk(worldserver.getChunkAt(this.chunkX, this.chunkZ), false, this.h)); + this.sendAll(new Packet51MapChunk(worldserver.getChunkAt(this.chunkX, this.chunkZ), (this.h == 0xFFFF), this.h)); // CraftBukkit - send everything (including biome) if all sections flagged for (k = 0; k < 16; ++k) { if ((this.h & 1 << k) != 0) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index e856b19aee..c153911df7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -203,18 +203,14 @@ public class CraftWorld implements World { int px = x << 4; int pz = z << 4; - // If there are more than 64 updates to a chunk at once, it carries out the update as a cuboid - // This flags 64 blocks along the bottom for update and then flags a block at the opposite corner at the top - // The cuboid that contains these 65 blocks covers the entire chunk - // The server will compress the chunk and send it to all clients - - for (int xx = px; xx < (px + 16); xx++) { - world.notify(xx, 0, pz); - world.notify(xx, 1, pz); - world.notify(xx, 2, pz); - world.notify(xx, 3, pz); + // If there are more than 64 updates to a chunk at once, it will update all 'touched' sections within the chunk + // And will include biome data if all sections have been 'touched' + // This flags 65 blocks distributed across all the sections of the chunk, so that everything is sent, including biomes + int height = getMaxHeight() / 16; + for (int idx = 0; idx < 64; idx++) { + world.notify(px + (idx / height), ((idx % height) * 16), pz); } - world.notify(px, 255, pz + 15); + world.notify(px + 15, (height * 16) - 1, pz + 15); return true; }