From 66741353bba3bb97b223c41bfc200b9ee04d5c7e Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Wed, 7 Dec 2022 03:50:06 +0100 Subject: Fix inventory backpack keybind not working without unrelated option (#468) --- .../miscgui/InventoryStorageSelector.java | 37 ++++------------------ 1 file changed, 7 insertions(+), 30 deletions(-) (limited to 'src/main/java/io') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java index 572b0fbf..205dcd83 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/InventoryStorageSelector.java @@ -79,33 +79,8 @@ public class InventoryStorageSelector { !NotEnoughUpdates.INSTANCE.config.storageGUI.showInvBackpack) { return; } - if (Minecraft.getMinecraft().currentScreen != null) { - return; - } - - if (NotEnoughUpdates.INSTANCE.config.storageGUI.arrowKeyBackpacks) { - if (KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowLeftKey)) { - NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex--; - - int max = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size() - 1; - if (NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex > max) - NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex = max; - if (NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex < 0) - NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex = 0; - } else if (KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowRightKey)) { - NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex++; - int max = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size() - 1; - if (NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex > max) - NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex = max; - if (NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex < 0) - NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex = 0; - } else if (KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowDownKey)) { - sendToPage(NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex); - } - } - - if (isSlotSelected()) { + if (Minecraft.getMinecraft().currentScreen == null && isSlotSelected()) { int useKeycode = Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode() + 100; int attackKeycode = Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode() + 100; @@ -147,11 +122,13 @@ public class InventoryStorageSelector { return; } + if (KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.backpackHotkey)) { + Minecraft.getMinecraft().thePlayer.inventory.currentItem = 0; + isOverridingSlot = true; + } + if (NotEnoughUpdates.INSTANCE.config.storageGUI.arrowKeyBackpacks) { - if (KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.backpackHotkey)) { - Minecraft.getMinecraft().thePlayer.inventory.currentItem = 0; - isOverridingSlot = true; - } else if (KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowLeftKey)) { + if (KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.storageGUI.arrowLeftKey)) { NotEnoughUpdates.INSTANCE.config.storageGUI.selectedIndex--; int max = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size() - 1; -- cgit