consistency between byte and short read methods

This commit is contained in:
Leijurv 2018-08-26 13:09:20 -07:00
parent f052c91cda
commit 74916dd24e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 2 additions and 8 deletions

View File

@ -247,10 +247,7 @@ public final class CachedRegion implements IBlockTypeAccess {
byte xz = in.readByte(); byte xz = in.readByte();
int X = xz & 0x0f; int X = xz & 0x0f;
int Z = (xz >>> 4) & 0x0f; int Z = (xz >>> 4) & 0x0f;
int Y = (int) in.readByte(); int Y = in.readByte() & 0xff;
if (Y < 0) {
Y += 256;
}
locs.add(new BlockPos(X, Y, Z)); locs.add(new BlockPos(X, Y, Z));
} }
} }

View File

@ -33,10 +33,7 @@ public class CachedRegionTest {
byte xz = part1; byte xz = part1;
int X = xz & 0x0f; int X = xz & 0x0f;
int Z = (xz >>> 4) & 0x0f; int Z = (xz >>> 4) & 0x0f;
int Y = (int) part2; int Y = part2 & 0xff;
if (Y < 0) {
Y += 256;
}
if (x != X || y != Y || z != Z) { if (x != X || y != Y || z != Z) {
System.out.println(x + " " + X + " " + y + " " + Y + " " + z + " " + Z); System.out.println(x + " " + X + " " + y + " " + Y + " " + z + " " + Z);
} }