diff --git a/src/main/java/me/cortex/voxy/common/world/SaveLoadSystem.java b/src/main/java/me/cortex/voxy/common/world/SaveLoadSystem.java index c688f305..71775061 100644 --- a/src/main/java/me/cortex/voxy/common/world/SaveLoadSystem.java +++ b/src/main/java/me/cortex/voxy/common/world/SaveLoadSystem.java @@ -126,7 +126,7 @@ public class SaveLoadSystem { int nonEmptyBlockCount = 0; for (int i = 0; i < WorldSection.SECTION_VOLUME; i++) { - long state = lut[MemoryUtil.memGetShort(ptr)]; ptr += 2; if (VERIFY_MEMORY_ACCESS && data.size<=(ptr-data.address)) throw new IllegalStateException("Memory access OOB"); + long state = lut[Short.toUnsignedInt(MemoryUtil.memGetShort(ptr))]; ptr += 2; if (VERIFY_MEMORY_ACCESS && data.size<=(ptr-data.address)) throw new IllegalStateException("Memory access OOB"); nonEmptyBlockCount += Mapper.isAir(state)?0:1; section.data[z2lin(i)] = state; }