Fixed Digital Chest not counting the ItemStack in output slot

This commit is contained in:
gigabit101 2015-11-12 20:22:41 +00:00
parent d9654782fe
commit 320d06e39e
2 changed files with 8 additions and 8 deletions

View file

@ -31,16 +31,15 @@ public class GuiDigitalChest extends GuiContainer {
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
} }
protected void drawGuiContainerForegroundLayer(int p_146979_1_, protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
int p_146979_2_) {
String name = StatCollector.translateToLocal("tile.techreborn.digitalChest.name"); 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(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString( this.fontRendererObj.drawString(
I18n.format("container.inventory", new Object[0]), 8, I18n.format("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752); this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Amount", 10, 20, 16448255); this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
if (tile.storedItem != null) if (tile.storedItem != null && tile.getStackInSlot(1) != null)
this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10, 30, 16448255); this.fontRendererObj.drawString(tile.storedItem.stackSize + tile.getStackInSlot(1).stackSize + "", 10, 30, 16448255);
if (tile.storedItem == null && tile.getStackInSlot(1) != null) if (tile.storedItem == null && tile.getStackInSlot(1) != null)
this.fontRendererObj.drawString(tile.getStackInSlot(1).stackSize + "", 10, 30, 16448255); this.fontRendererObj.drawString(tile.getStackInSlot(1).stackSize + "", 10, 30, 16448255);
} }

View file

@ -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 //TODO use long so we can have 9,223,372,036,854,775,807 items instead of 2,147,483,647
int storage = 32767; int storage = 32767;
public Inventory inventory = new Inventory(3, "TileDigitalChest", public Inventory inventory = new Inventory(3, "TileDigitalChest", storage);
storage);
public ItemStack storedItem; public ItemStack storedItem;
@ -75,14 +74,16 @@ public class TileDigitalChest extends TileMachineBase implements IInventory,
itemStack.stackSize = itemStack.getMaxStackSize(); itemStack.stackSize = itemStack.getMaxStackSize();
setInventorySlotContents(1, itemStack); setInventorySlotContents(1, itemStack);
storedItem.stackSize -= itemStack.getMaxStackSize(); 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; int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize;
if (storedItem.stackSize >= wanted) if (storedItem.stackSize >= wanted)
{ {
decrStackSize(1, -wanted); decrStackSize(1, -wanted);
storedItem.stackSize -= wanted; storedItem.stackSize -= wanted;
} else }
else
{ {
decrStackSize(1, -storedItem.stackSize); decrStackSize(1, -storedItem.stackSize);
storedItem = null; storedItem = null;