diff --git a/resources/assets/enderio/lang/en_US.lang b/resources/assets/enderio/lang/en_US.lang index aa7425a8..d02593aa 100644 --- a/resources/assets/enderio/lang/en_US.lang +++ b/resources/assets/enderio/lang/en_US.lang @@ -499,6 +499,11 @@ enderio.gui.inventorypanel.tooltip.sort.count_down.line1=Sort items by their qua enderio.gui.inventorypanel.tooltip.sort.count_down.line2=Starting with the highest quantity enderio.gui.inventorypanel.tooltip.sort.count_up.line1=Sort items by their quantity enderio.gui.inventorypanel.tooltip.sort.count_up.line2=Starting with the lonely ones +enderio.gui.inventorypanel.tooltip.refill.line1=Refills the crafting grid +enderio.gui.inventorypanel.tooltip.refill.line2=A normal click puts items +enderio.gui.inventorypanel.tooltip.refill.line3=for one crafting opperations, +enderio.gui.inventorypanel.tooltip.refill.line4=while a shift click tries to +enderio.gui.inventorypanel.tooltip.refill.line5=fill the crafting grid. enderio.machine.tooltip.configured=(Configured) diff --git a/resources/assets/enderio/textures/gui/inventorypanel.png b/resources/assets/enderio/textures/gui/inventorypanel.png index 323de295..b1cb2228 100644 Binary files a/resources/assets/enderio/textures/gui/inventorypanel.png and b/resources/assets/enderio/textures/gui/inventorypanel.png differ diff --git a/src/main/java/crazypants/enderio/machine/invpanel/GuiInventoryPanel.java b/src/main/java/crazypants/enderio/machine/invpanel/GuiInventoryPanel.java index 8ec1acbf..1b910b94 100644 --- a/src/main/java/crazypants/enderio/machine/invpanel/GuiInventoryPanel.java +++ b/src/main/java/crazypants/enderio/machine/invpanel/GuiInventoryPanel.java @@ -36,6 +36,8 @@ public class GuiInventoryPanel extends GuiMachineBase { private static final Rectangle scrollbarArea = new Rectangle(215, 27, 11, 90); private static final Rectangle inventoryArea = new Rectangle(107, 27, 108, 90); + private static final Rectangle btnRefill = new Rectangle(85, 32, 20, 20); + private static final int ID_SORT = 9876; private static final int GHOST_COLUMNS = 6; @@ -43,6 +45,7 @@ public class GuiInventoryPanel extends GuiMachineBase { private final TextFieldEIO tfFilter; private final IconButtonEIO btnSort; + private final GuiToolTip ttRefill; private boolean scrollUpPressed; private boolean scrollDownPressed; @@ -98,10 +101,17 @@ public class GuiInventoryPanel extends GuiMachineBase { return !getContainer().getSlotFilter().getHasStack() && super.shouldDraw(); } }); + + list = new ArrayList(); + TooltipAddera.addTooltipFromResources(list, "enderio.gui.inventorypanel.tooltip.refill.line"); + ttRefill = new GuiToolTip(btnRefill, list); + ttRefill.setVisible(false); + addToolTip(ttRefill); } public void setCraftingHelper(ICraftingHelper craftingHelper) { this.craftingHelper = craftingHelper; + ttRefill.setVisible(craftingHelper != null); } @Override @@ -120,7 +130,7 @@ public class GuiInventoryPanel extends GuiMachineBase { } @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderUtil.bindTexture("enderio:textures/gui/inventorypanel.png"); int sx = guiLeft; @@ -128,6 +138,12 @@ public class GuiInventoryPanel extends GuiMachineBase { drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize); + if(craftingHelper != null) { + boolean hover = btnRefill.contains(mouseX - sx, mouseY - sy); + int iconX = hover ? (isShiftKeyDown() ? 48 : 24) : 0; + drawTexturedModalRect(sx + btnRefill.x - 2, sy + btnRefill.y - 2, iconX, 232, 24, 24); + } + long time = Minecraft.getSystemTime(); if((time - scrollLastTime) >= 100) { scrollLastTime = time; @@ -166,7 +182,7 @@ public class GuiInventoryPanel extends GuiMachineBase { fr.drawString(headerReturn, sx+7, sy+72, headerColor); fr.drawString(headerInventory, sx+38, sy+120, headerColor); - super.drawGuiContainerBackgroundLayer(par1, par2, par3); + super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY); if(getTileEntity().isActive()) { tfFilter.setEnabled(true); @@ -292,6 +308,10 @@ public class GuiInventoryPanel extends GuiMachineBase { x -= guiLeft; y -= guiTop; + if(craftingHelper != null && btnRefill.contains(x, y)) { + craftingHelper.refill(this, isShiftKeyDown() ? 64 : 1); + } + if(scrollMax > 0 && thumbArea.contains(x, y)) { int thumbPos = getThumbPosition(); scrollUpPressed = y < thumbPos;