diff options
Diffstat (limited to 'src/main/java/net/minecraft/server/Packet56MapChunkBulk.java')
-rw-r--r-- | src/main/java/net/minecraft/server/Packet56MapChunkBulk.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java index 07681a88..867ebd3a 100644 --- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java +++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java @@ -17,6 +17,7 @@ public class Packet56MapChunkBulk extends Packet { private byte[] buffer; private byte[][] inflatedBuffers; private int size; + private boolean h; private byte[] buildBuffer = new byte[0]; // CraftBukkit - remove static // CraftBukkit start static final ThreadLocal<Deflater> localDeflater = new ThreadLocal<Deflater>() { @@ -38,6 +39,7 @@ public class Packet56MapChunkBulk extends Packet { this.a = new int[i]; this.b = new int[i]; this.inflatedBuffers = new byte[i][]; + this.h = !list.isEmpty() && !((Chunk) list.get(0)).world.worldProvider.f; int j = 0; for (int k = 0; k < i; ++k) { @@ -94,6 +96,7 @@ public class Packet56MapChunkBulk extends Packet { short short1 = datainputstream.readShort(); this.size = datainputstream.readInt(); + this.h = datainputstream.readBoolean(); this.c = new int[short1]; this.d = new int[short1]; this.a = new int[short1]; @@ -125,17 +128,24 @@ public class Packet56MapChunkBulk extends Packet { this.a[j] = datainputstream.readShort(); this.b[j] = datainputstream.readShort(); int k = 0; + int l = 0; - int l; + int i1; - for (l = 0; l < 16; ++l) { - k += this.a[j] >> l & 1; + for (i1 = 0; i1 < 16; ++i1) { + k += this.a[j] >> i1 & 1; + l += this.b[j] >> i1 & 1; } - l = 2048 * 5 * k + 256; - this.inflatedBuffers[j] = new byte[l]; - System.arraycopy(abyte, i, this.inflatedBuffers[j], 0, l); - i += l; + i1 = 2048 * 4 * k + 256; + i1 += 2048 * l; + if (this.h) { + i1 += 2048 * k; + } + + this.inflatedBuffers[j] = new byte[i1]; + System.arraycopy(abyte, i, this.inflatedBuffers[j], 0, i1); + i += i1; } } @@ -143,6 +153,7 @@ public class Packet56MapChunkBulk extends Packet { compress(); // CraftBukkit dataoutputstream.writeShort(this.c.length); dataoutputstream.writeInt(this.size); + dataoutputstream.writeBoolean(this.h); dataoutputstream.write(this.buffer, 0, this.size); for (int i = 0; i < this.c.length; ++i) { @@ -153,8 +164,8 @@ public class Packet56MapChunkBulk extends Packet { } } - public void handle(NetHandler nethandler) { - nethandler.a(this); + public void handle(Connection connection) { + connection.a(this); } public int a() { |