From 320d06e39e3c58e4edc788c32e38fdbdf137fedc Mon Sep 17 00:00:00 2001 From: gigabit101 Date: Thu, 12 Nov 2015 20:22:41 +0000 Subject: [PATCH] Fixed Digital Chest not counting the ItemStack in output slot --- src/main/java/techreborn/client/gui/GuiDigitalChest.java | 7 +++---- src/main/java/techreborn/tiles/TileDigitalChest.java | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/techreborn/client/gui/GuiDigitalChest.java b/src/main/java/techreborn/client/gui/GuiDigitalChest.java index 92542e101..476d422e4 100644 --- a/src/main/java/techreborn/client/gui/GuiDigitalChest.java +++ b/src/main/java/techreborn/client/gui/GuiDigitalChest.java @@ -31,16 +31,15 @@ public class GuiDigitalChest extends GuiContainer { this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); } - protected void drawGuiContainerForegroundLayer(int p_146979_1_, - int p_146979_2_) { + protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { String name = StatCollector.translateToLocal("tile.techreborn.digitalChest.name"); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString( I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); this.fontRendererObj.drawString("Amount", 10, 20, 16448255); - if (tile.storedItem != null) - this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10, 30, 16448255); + if (tile.storedItem != null && tile.getStackInSlot(1) != null) + this.fontRendererObj.drawString(tile.storedItem.stackSize + tile.getStackInSlot(1).stackSize + "", 10, 30, 16448255); if (tile.storedItem == null && tile.getStackInSlot(1) != null) this.fontRendererObj.drawString(tile.getStackInSlot(1).stackSize + "", 10, 30, 16448255); } diff --git a/src/main/java/techreborn/tiles/TileDigitalChest.java b/src/main/java/techreborn/tiles/TileDigitalChest.java index 63bf0b94b..543f4909c 100644 --- a/src/main/java/techreborn/tiles/TileDigitalChest.java +++ b/src/main/java/techreborn/tiles/TileDigitalChest.java @@ -25,8 +25,7 @@ public class TileDigitalChest extends TileMachineBase implements IInventory, //TODO use long so we can have 9,223,372,036,854,775,807 items instead of 2,147,483,647 int storage = 32767; - public Inventory inventory = new Inventory(3, "TileDigitalChest", - storage); + public Inventory inventory = new Inventory(3, "TileDigitalChest", storage); public ItemStack storedItem; @@ -75,14 +74,16 @@ public class TileDigitalChest extends TileMachineBase implements IInventory, itemStack.stackSize = itemStack.getMaxStackSize(); setInventorySlotContents(1, itemStack); storedItem.stackSize -= itemStack.getMaxStackSize(); - } else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) + } + else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) { int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize; if (storedItem.stackSize >= wanted) { decrStackSize(1, -wanted); storedItem.stackSize -= wanted; - } else + } + else { decrStackSize(1, -storedItem.stackSize); storedItem = null;