From 74916dd24ed1c7a755f220db9c92ce9047681afb Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 26 Aug 2018 13:09:20 -0700 Subject: [PATCH] consistency between byte and short read methods --- src/main/java/baritone/chunk/CachedRegion.java | 5 +---- src/test/java/baritone/chunk/CachedRegionTest.java | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) 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); }