use short to store index of inventory slot

This commit is contained in:
Dennis committed 2023-05-20 22:38:48 +03:00
1 parent ebc33ed4b2
commit f941141879
1 file changed
+2 -2
@@ -114,7 +114,7 @@ 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.getByte("Slot") & 255;
int j = nbttagcompound1.getShort("Slot") & 0xffff;
if (j >= 0 && j < this.inventory.length) {
this.inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
@@ -150,7 +150,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory, I
for (int i = 0; i < this.inventory.length; ++i) {
if (this.inventory[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i);
nbttagcompound1.setShort("Slot", (short) i);
this.inventory[i].writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}