World height related fixes - 128 -> 256. Addresses BUKKIT-889

This commit is contained in:
Mike Primm 2012-03-01 15:13:53 -06:00 committed by EvilSeph
parent efc9ced128
commit 82f2a2e773
7 changed files with 15 additions and 15 deletions

View file

@ -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;

View file

@ -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;

View file

@ -18,7 +18,7 @@ public final class ChunkCompressionThread implements Runnable {
private final HashMap<EntityPlayer, Integer> queueSizePerPlayer = new HashMap<EntityPlayer, Integer>();
private final BlockingQueue<QueuedPacket> packetQueue = new LinkedBlockingQueue<QueuedPacket>(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;

View file

@ -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() {

View file

@ -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;
}

View file

@ -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;

View file

@ -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);
}