diff --git a/common/src/common/network/PacketBuffer.java b/common/src/common/network/PacketBuffer.java index 4d0df41..390c141 100755 --- a/common/src/common/network/PacketBuffer.java +++ b/common/src/common/network/PacketBuffer.java @@ -58,16 +58,14 @@ public class PacketBuffer public BlockPos readBlockPos() { -// return new BlockPos(this.readInt(), this.readInt(), this.readInt()); - return BlockPos.fromLong(this.readLong()); + return new BlockPos(this.readInt(), this.readInt(), this.readInt()); } public void writeBlockPos(BlockPos pos) { - this.writeLong(pos.toLong()); -// this.writeInt(pos.getX()); -// this.writeInt(pos.getY()); -// this.writeInt(pos.getZ()); + this.writeInt(pos.getX()); + this.writeInt(pos.getY()); + this.writeInt(pos.getZ()); } // public Text readChatComponent() throws IOException diff --git a/common/src/common/util/BlockPos.java b/common/src/common/util/BlockPos.java index 493452c..160736e 100755 --- a/common/src/common/util/BlockPos.java +++ b/common/src/common/util/BlockPos.java @@ -8,14 +8,6 @@ import common.entity.Entity; public class BlockPos extends Vec3i { public static final BlockPos ORIGIN = new BlockPos(0, 0, 0); - private static final int NUM_X_BITS = 1 + 26; // ExtMath.calculateLogBaseTwo(ExtMath.roundUpToPowerOfTwo(World.MAX_SIZE)); - private static final int NUM_Z_BITS = NUM_X_BITS; - private static final int NUM_Y_BITS = 64 - NUM_X_BITS - NUM_Z_BITS; - private static final int Y_SHIFT = 0 + NUM_Z_BITS; - private static final int X_SHIFT = Y_SHIFT + NUM_Y_BITS; - private static final long X_MASK = (1L << NUM_X_BITS) - 1L; - private static final long Y_MASK = (1L << NUM_Y_BITS) - 1L; - private static final long Z_MASK = (1L << NUM_Z_BITS) - 1L; public BlockPos(int x, int y, int z) { @@ -194,19 +186,6 @@ public class BlockPos extends Vec3i return new BlockPos(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX()); } - public long toLong() - { - return ((long)this.getX() & X_MASK) << X_SHIFT | ((long)this.getY() & Y_MASK) << Y_SHIFT | ((long)this.getZ() & Z_MASK) << 0; - } - - public static BlockPos fromLong(long serialized) - { - int i = (int)(serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS); - int j = (int)(serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS); - int k = (int)(serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS); - return new BlockPos(i, j, k); - } - public static Iterable getAllInBox(BlockPos from, BlockPos to) { final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));