From 8a1d9c78eb94231bcd8a2c258aea8bf74f00fb28 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Tue, 19 Sep 2017 15:11:00 +0300 Subject: [PATCH] Dirty fix for empty itemstack. Closes #1255 --- src/main/java/techreborn/tiles/TileTechStorageBase.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/techreborn/tiles/TileTechStorageBase.java b/src/main/java/techreborn/tiles/TileTechStorageBase.java index 4f9c3a5cf..271807272 100644 --- a/src/main/java/techreborn/tiles/TileTechStorageBase.java +++ b/src/main/java/techreborn/tiles/TileTechStorageBase.java @@ -141,7 +141,11 @@ public class TileTechStorageBase extends TileLegacyMachineBase public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) { if (!storedItem.isEmpty()) { - tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound())); + ItemStack temp = storedItem.copy(); + if (storedItem.getCount() > storedItem.getMaxStackSize()){ + temp.setCount(storedItem.getMaxStackSize()); + } + tagCompound.setTag("storedStack", temp.writeToNBT(new NBTTagCompound())); tagCompound.setInteger("storedQuantity", storedItem.getCount()); } else { tagCompound.setInteger("storedQuantity", 0);