From 82f2a2e773816ef465c866b25fb57b505737cdfa Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Thu, 1 Mar 2012 15:13:53 -0600 Subject: [PATCH] World height related fixes - 128 -> 256. Addresses BUKKIT-889 --- src/main/java/net/minecraft/server/PortalTravelAgent.java | 6 +++--- src/main/java/net/minecraft/server/World.java | 2 +- .../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 ++++---- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java index e75220af2c..be3c2b78e5 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -66,7 +66,7 @@ public class PortalTravelAgent { for (int k1 = i1 - short1; k1 <= i1 + short1; ++k1) { double d3 = (double) k1 + 0.5D - entity.locZ; - for (int l1 = 127; l1 >= 0; --l1) { + for (int l1 = 255; l1 >= 0; --l1) { // CraftBukkit - 127 -> 255 if (world.getTypeId(j1, l1, k1) == Block.PORTAL.id) { while (world.getTypeId(j1, l1 - 1, k1) == Block.PORTAL.id) { --l1; @@ -150,7 +150,7 @@ public class PortalTravelAgent { d2 = (double) j2 + 0.5D - entity.locZ; label274: - for (l2 = 127; l2 >= 0; --l2) { + for (l2 = 255; l2 >= 0; --l2) { // CraftBukkit - 127 -> 255 if (world.isEmpty(i2, l2, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) { --l2; @@ -201,7 +201,7 @@ public class PortalTravelAgent { d2 = (double) j2 + 0.5D - entity.locZ; label222: - for (l2 = 127; l2 >= 0; --l2) { + for (l2 = 255; l2 >= 0; --l2) { // CraftBukkit - 127 -> 255 if (world.isEmpty(i2, l2, j2)) { while (l2 > 0 && world.isEmpty(i2, l2 - 1, j2)) { --l2; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 6cbadc1c6c..2202b0ed10 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1923,7 +1923,7 @@ public class World implements IBlockAccess { int k = this.g >> 2; int l = k & 15; int i1 = k >> 8 & 15; - int j1 = k >> 16 & 127; + int j1 = k >> 16 & 255; // CraftBukkit - 127 -> 255 int k1 = chunk.getTypeId(l, j1, i1); l += i; diff --git a/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java b/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java index dcab889bcf..4303c60b38 100644 --- a/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java +++ b/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/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 0cfd5fe002..f4d2d0bde0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/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/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 1d53bd539e..6b9553ebd6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/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/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java b/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java index 495c586a08..72cc84e1c2 100644 --- a/src/main/java/org/bukkit/craftbukkit/PortalTravelAgent.java +++ b/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/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 89ffd25ff8..ec8d156a87 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/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); }