*correct id

This commit is contained in:
Jesse Boyd 2016-04-25 07:07:27 +10:00
parent 362490938c
commit 644dfc512a

View File

@ -99,12 +99,12 @@ public class DiskOptimizedClipboard extends FaweClipboard {
} }
raf.read(buffer); raf.read(buffer);
last = i; last = i;
int id = ((buffer[1] << 4) + (buffer[0] >> 4)); int id = ((((int) buffer[1] & 0xFF) << 4) + (((int) buffer[0] & 0xFF) >> 4));
BaseBlock block; BaseBlock block;
if (!FaweCache.hasData(id)) { if (!FaweCache.hasData(id)) {
block = FaweCache.CACHE_BLOCK[id << 4]; block = FaweCache.CACHE_BLOCK[id << 4];
} else { } else {
block = FaweCache.CACHE_BLOCK[(id << 4) + (buffer[0] & 0xf)]; block = FaweCache.CACHE_BLOCK[(id << 4) + (buffer[0] & 0xF)];
} }
if (FaweCache.hasNBT(id)) { if (FaweCache.hasNBT(id)) {
CompoundTag nbt = nbtMap.get(new IntegerTrio(x, y, z)); CompoundTag nbt = nbtMap.get(new IntegerTrio(x, y, z));
@ -135,7 +135,7 @@ public class DiskOptimizedClipboard extends FaweClipboard {
final int data = block.getData(); final int data = block.getData();
int combined = (id << 4) + data; int combined = (id << 4) + data;
buffer[0] = (byte) ((combined) & 0xff); buffer[0] = (byte) ((combined) & 0xff);
buffer[1] = (byte) (((combined) >> 8) & 0xff); buffer[1] = (byte) (((combined) >> 8) & 0xFF);
raf.write(buffer); raf.write(buffer);
if (FaweCache.hasNBT(id)) { if (FaweCache.hasNBT(id)) {
nbtMap.put(new IntegerTrio(x, y, z), block.getNbtData()); nbtMap.put(new IntegerTrio(x, y, z), block.getNbtData());