From 171d1b3f25b68bebea9c621036c92348c3536a42 Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sun, 9 Jan 2022 18:46:27 -0800 Subject: [PATCH] Fix clicking on inventory slots (#37) * Fix clicking on inventory slots. * resort to hacks * one more hack --- .../tools/gui/CraftingStationGui.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java index be5e7bfe..447c932a 100644 --- a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java +++ b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java @@ -375,9 +375,9 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler { chestLeft = guiLeft - chestWidth; chestTop = guiTop; - // Leaving out the xsize increase by chestSize and adjusting where it's used, because otherwise it shifts both the bookmarks and item panel - // way too far out. - //xSize += guiLeft - chestLeft; + // Leaving out the xSize increase by chestSize and adjusting where it's used, because otherwise it shifts both the bookmarks and item panel + // way too far out. If anything (mouseClick, for example) relies on xSize, you'll need to hack it like below. +// xSize += guiLeft - chestLeft; guiLeft = chestLeft; if (logic.doubleChest != null) @@ -393,6 +393,22 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler { updateChestSlots(); } + + @Override + protected void mouseClicked(int x, int y, int button) { + // Hacks + xSize += chestWidth; + super.mouseClicked(x, y, button); + xSize -= chestWidth; + } + + @Override + protected void mouseMovedOrUp(int x, int y, int button) { + // Hacks + xSize += chestWidth; + super.mouseMovedOrUp(x, y, button); + xSize -= chestWidth; + } // updates slot visibility protected void updateChestSlots() {