From 02109efbfc5d36b91059926f6e248e23d57b28b9 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 1 Mar 2012 15:13:53 -0600 Subject: [PATCH] World height related fixes - 128 -> 256. Addresses BUKKIT-889 By: Mike Primm --- .../org/bukkit/craftbukkit/ChunkCompressionThread.java | 2 +- .../src/main/java/org/bukkit/craftbukkit/CraftChunk.java | 2 +- .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 4 ++-- .../java/org/bukkit/craftbukkit/PortalTravelAgent.java | 6 +++--- .../java/org/bukkit/craftbukkit/block/CraftBlock.java | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java b/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java index dcab889bcf..4303c60b38 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java @@ -18,7 +18,7 @@ public final class ChunkCompressionThread implements Runnable { private final HashMap queueSizePerPlayer = new HashMap(); private final BlockingQueue packetQueue = new LinkedBlockingQueue(QUEUE_CAPACITY); - private final int CHUNK_SIZE = 16 * 128 * 16 * 5 / 2; + private final int CHUNK_SIZE = 16 * 256 * 16 * 5 / 2; private final int REDUCED_DEFLATE_THRESHOLD = CHUNK_SIZE / 4; private final int DEFLATE_LEVEL_CHUNKS = 6; private final int DEFLATE_LEVEL_PARTS = 1; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 0cfd5fe002..f4d2d0bde0 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -69,7 +69,7 @@ public class CraftChunk implements Chunk { } public Block getBlock(int x, int y, int z) { - return new CraftBlock(this, (getX() << 4) | (x & 0xF), y & 0x7F, (getZ() << 4) | (z & 0xF)); + return new CraftBlock(this, (getX() << 4) | (x & 0xF), y & 0xFF, (getZ() << 4) | (z & 0xF)); } public Entity[] getEntities() { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 1d53bd539e..6b9553ebd6 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -78,7 +78,7 @@ public class CraftWorld implements World { } public Block getBlockAt(int x, int y, int z) { - return getChunkAt(x >> 4, z >> 4).getBlock(x & 0xF, y & 0x7F, z & 0xF); + return getChunkAt(x >> 4, z >> 4).getBlock(x & 0xF, y & 0xFF, z & 0xF); } public int getBlockTypeIdAt(int x, int y, int z) { @@ -224,7 +224,7 @@ public class CraftWorld implements World { for (int xx = px; xx < (px + 16); xx++) { world.notify(xx, 0, pz); } - world.notify(px, 127, pz + 15); + world.notify(px, 255, pz + 15); return true; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java b/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java index 495c586a08..72cc84e1c2 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java @@ -87,7 +87,7 @@ public class PortalTravelAgent implements TravelAgent { for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) { double d3 = (double) k1 + 0.5D - location.getZ(); - for (int l1 = 127; l1 >= 0; --l1) { + for (int l1 = 255; l1 >= 0; --l1) { if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) { while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) { --l1; @@ -194,7 +194,7 @@ public class PortalTravelAgent implements TravelAgent { d2 = (double) j2 + 0.5D - location.getZ(); label271: - for (l2 = 127; l2 >= 0; --l2) { + for (l2 = 255; l2 >= 0; --l2) { if (world.isEmpty(i2, l2, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) { --l2; @@ -245,7 +245,7 @@ public class PortalTravelAgent implements TravelAgent { d2 = (double) j2 + 0.5D - location.getZ(); label219: - for (l2 = 127; l2 >= 0; --l2) { + for (l2 = 255; l2 >= 0; --l2) { if (world.isEmpty(i2, l2, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) { --l2; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 89ffd25ff8..ec8d156a87 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -80,7 +80,7 @@ public class CraftBlock implements Block { } public byte getData() { - return (byte) chunk.getHandle().getData(this.x & 0xF, this.y & 0x7F, this.z & 0xF); + return (byte) chunk.getHandle().getData(this.x & 0xF, this.y & 0xFF, this.z & 0xF); } public void setType(final Material type) { @@ -116,7 +116,7 @@ public class CraftBlock implements Block { } public int getTypeId() { - return chunk.getHandle().getTypeId(this.x & 0xF, this.y & 0x7F, this.z & 0xF); + return chunk.getHandle().getTypeId(this.x & 0xF, this.y & 0xFF, this.z & 0xF); } public byte getLightLevel() { @@ -124,11 +124,11 @@ public class CraftBlock implements Block { } public byte getLightFromSky() { - return (byte) chunk.getHandle().getBrightness(EnumSkyBlock.SKY, this.x & 0xF, this.y & 0x7F, this.z & 0xF); + return (byte) chunk.getHandle().getBrightness(EnumSkyBlock.SKY, this.x & 0xF, this.y & 0xFF, this.z & 0xF); } public byte getLightFromBlocks() { - return (byte) chunk.getHandle().getBrightness(EnumSkyBlock.BLOCK, this.x & 0xF, this.y & 0x7F, this.z & 0xF); + return (byte) chunk.getHandle().getBrightness(EnumSkyBlock.BLOCK, this.x & 0xF, this.y & 0xFF, this.z & 0xF); }