From 6e3f6e1e5d96c0ae492213cbecf109180af7e924 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Sun, 7 Dec 2014 21:24:38 +0100 Subject: [PATCH 1/2] Add a small tooltip to the seared tanks so they can be found when searching for 'smeltery' in NEI. --- resources/assets/tinker/lang/en_US.lang | 1 + .../java/tconstruct/smeltery/itemblocks/LavaTankItemBlock.java | 1 + 2 files changed, 2 insertions(+) diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index 44056f24..2143a9e0 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -662,6 +662,7 @@ manual2.tooltip=By: Skyla manual3.tooltip=By: Thruul M'gon searedtank1.tooltip=Contains searedtank2.tooltip=Keeps any fluids it has when harvested +searedtank3.tooltip=Heart of the Smeltery oreberries1.tooltip=Sweet Irony oreberries2.tooltip=Pure Luster oreberries3.tooltip=Tastes like metal diff --git a/src/main/java/tconstruct/smeltery/itemblocks/LavaTankItemBlock.java b/src/main/java/tconstruct/smeltery/itemblocks/LavaTankItemBlock.java index ee4896ce..f3efad02 100644 --- a/src/main/java/tconstruct/smeltery/itemblocks/LavaTankItemBlock.java +++ b/src/main/java/tconstruct/smeltery/itemblocks/LavaTankItemBlock.java @@ -33,6 +33,7 @@ public class LavaTankItemBlock extends MultiItemBlock } else { + list.add(StatCollector.translateToLocal("searedtank3.tooltip")); list.add(StatCollector.translateToLocal("searedtank2.tooltip")); } } From fcb4b1f0da215b2b39d8f21d5e94b4379fd6330a Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Sun, 7 Dec 2014 21:54:34 +0100 Subject: [PATCH 2/2] Fix dupe bug with increasing smeltery size while gui is open. #1218 Additionally GUI now closes on smeltery size change, to prevent a crash when it's made smaller. And for consistency. --- .../tconstruct/smeltery/gui/SmelteryGui.java | 21 +++++++++++++------ .../smeltery/inventory/SmelteryContainer.java | 10 ++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java index c804c6c4..9b7d848d 100644 --- a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java +++ b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java @@ -28,12 +28,14 @@ public class SmelteryGui extends ActiveContainerGui private int prevSlotPos = 0; private final int columns; + private final int smelterySize; public static final int maxRows = 8; public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z) { super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z)); logic = smeltery; + smelterySize = smeltery.getBlockCapacity(); smeltery.updateFuelDisplay(); columns = ((SmelteryContainer) this.inventorySlots).columns; @@ -52,13 +54,20 @@ public class SmelteryGui extends ActiveContainerGui @Override public void drawScreen (int mouseX, int mouseY, float par3) { + // the smeltery changed. we close the screen because updating the changes in all containers would be way too complicated. + if(logic.getBlockCapacity() != smelterySize) + { + mc.thePlayer.closeScreen(); + return; + } + super.drawScreen(mouseX, mouseY, par3); updateScrollbar(mouseX, mouseY, par3); } protected void updateScrollbar (int mouseX, int mouseY, float par3) { - if (logic.getBlockCapacity() > columns * maxRows) + if (smelterySize > columns * maxRows) { boolean mouseDown = Mouse.isButtonDown(0); int lefto = this.guiLeft; @@ -217,13 +226,13 @@ public class SmelteryGui extends ActiveContainerGui // Side inventory int xleft = 46; xleft += 22 * (columns - 3); // we have to shift the whole thing to the left if we have more than 3 columns - int h = logic.getBlockCapacity() / columns; - if (logic.getBlockCapacity() % columns != 0) + int h = smelterySize / columns; + if (smelterySize % columns != 0) h++; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(backgroundSide); - if (logic.getBlockCapacity() > 0) + if (smelterySize > 0) { if (h >= 8) { @@ -269,11 +278,11 @@ public class SmelteryGui extends ActiveContainerGui xleft -= 8; // Temperature - int slotSize = logic.getBlockCapacity(); + int slotSize = smelterySize; if (slotSize > columns * maxRows) slotSize = columns * maxRows; int iter; - for (iter = 0; iter < slotSize && iter + slotPos * columns < logic.getBlockCapacity(); iter++) + for (iter = 0; iter < slotSize && iter + slotPos * columns < smelterySize; iter++) { int slotTemp = logic.getTempForSlot(iter + slotPos * columns) - 20; int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * columns) - 20; diff --git a/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java b/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java index 3bce0146..e26fec83 100644 --- a/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java +++ b/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java @@ -15,6 +15,7 @@ public class SmelteryContainer extends ActiveContainer public int fuel = 0; private int slotRow; public int columns; + public final int smelterySize; public SmelteryContainer(InventoryPlayer inventoryplayer, SmelteryLogic smeltery) { @@ -22,6 +23,7 @@ public class SmelteryContainer extends ActiveContainer playerInv = inventoryplayer; slotRow = 0; columns = smeltery.getBlocksPerLayer() >= 16 ? 4 : 3; + smelterySize = smeltery.getBlockCapacity(); /* Smeltery inventory */ @@ -96,7 +98,9 @@ public class SmelteryContainer extends ActiveContainer @Override public void detectAndSendChanges () // TODO: Sync with this { - super.detectAndSendChanges(); + // we only update if the size is the same, since the screen is getting closed on sizechange and would cause a crash otherwise + if(smelterySize == this.inventorySlots.size()) + super.detectAndSendChanges(); /* * for (int i = 0; i < crafters.size(); i++) { ICrafting icrafting = * (ICrafting)crafters.get(i); if (progress != logic.progress) { @@ -145,14 +149,14 @@ public class SmelteryContainer extends ActiveContainer ItemStack slotStack = slot.getStack(); stack = slotStack.copy(); - if (slotID < logic.getSizeInventory()) + if (slotID < smelterySize) { if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) { return null; } } - else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false)) + else if (!this.mergeItemStack(slotStack, 0, smelterySize, false)) { return null; }