diff --git a/src/main/java/baritone/chunk/CachedRegion.java b/src/main/java/baritone/chunk/CachedRegion.java index 0fbe8b4e..7d2ed3dc 100644 --- a/src/main/java/baritone/chunk/CachedRegion.java +++ b/src/main/java/baritone/chunk/CachedRegion.java @@ -247,10 +247,7 @@ public final class CachedRegion implements IBlockTypeAccess { byte xz = in.readByte(); int X = xz & 0x0f; int Z = (xz >>> 4) & 0x0f; - int Y = (int) in.readByte(); - if (Y < 0) { - Y += 256; - } + int Y = in.readByte() & 0xff; locs.add(new BlockPos(X, Y, Z)); } } diff --git a/src/test/java/baritone/chunk/CachedRegionTest.java b/src/test/java/baritone/chunk/CachedRegionTest.java index 0992cee1..8350390c 100644 --- a/src/test/java/baritone/chunk/CachedRegionTest.java +++ b/src/test/java/baritone/chunk/CachedRegionTest.java @@ -33,10 +33,7 @@ public class CachedRegionTest { byte xz = part1; int X = xz & 0x0f; int Z = (xz >>> 4) & 0x0f; - int Y = (int) part2; - if (Y < 0) { - Y += 256; - } + int Y = part2 & 0xff; if (x != X || y != Y || z != Z) { System.out.println(x + " " + X + " " + y + " " + Y + " " + z + " " + Z); }