From aab41d1a45c4a4b8d3b1cd5bc69e9d078803a3fa Mon Sep 17 00:00:00 2001 From: Dennis Date: Sun, 21 May 2023 00:57:26 +0300 Subject: [PATCH] Backwards compatibility for old nbt --- src/main/java/mantle/blocks/abstracts/InventoryLogic.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/mantle/blocks/abstracts/InventoryLogic.java b/src/main/java/mantle/blocks/abstracts/InventoryLogic.java index fc1ea76..b095b05 100644 --- a/src/main/java/mantle/blocks/abstracts/InventoryLogic.java +++ b/src/main/java/mantle/blocks/abstracts/InventoryLogic.java @@ -114,7 +114,11 @@ public abstract class InventoryLogic extends TileEntity implements IInventory, I for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - int j = nbttagcompound1.getShort("Slot") & 0xffff; + + int j = nbttagcompound1.getShort("Slot"); + + // Backwards compatibility for when "Slot" was stored in a byte + if (j < 0) j += 256; if (j >= 0 && j < this.inventory.length) { this.inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);