diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-05-04 12:04:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-04 12:04:23 +0200 |
commit | 8b170c0dd2685358bb00cd73da06063cdb011961 (patch) | |
tree | f2717c550dfc1b60ad0dc93f006c57ba50f611d1 /src/main | |
parent | a33192c6bff789cdf9c814d5f74f2d862d46eb5f (diff) | |
download | skyhanni-8b170c0dd2685358bb00cd73da06063cdb011961.tar.gz skyhanni-8b170c0dd2685358bb00cd73da06063cdb011961.tar.bz2 skyhanni-8b170c0dd2685358bb00cd73da06063cdb011961.zip |
Fix: inventory hotkeys hotbar item move behaviour (#1690)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main')
3 files changed, 29 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt index 44f8a51b6..71ce9c41e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HarpFeatures.kt @@ -152,6 +152,17 @@ object HarpFeatures { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (!LorenzUtils.inSkyBlock) return + + if (isHarpGui(InventoryUtils.openInventoryName())) { + if (config.keybinds) { + // needed to not send duplicate clicks via keybind feature + if (event.clickTypeEnum == GuiContainerEvent.ClickType.HOTBAR) { + event.cancel() + return + } + } + } + if (!config.quickRestart) return if (!isMenuGui(InventoryUtils.openInventoryName())) return if (event.slot?.slotNumber != closeButtonSlot) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt index 42dcdae8a..587f265da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryInventory.kt @@ -92,7 +92,11 @@ object ChocolateFactoryInventory { val slotNumber = slot.slotNumber if (!config.useMiddleClick) return if (slotNumber in ChocolateFactoryAPI.noPickblockSlots && - (slotNumber != ChocolateFactoryAPI.timeTowerIndex || event.clickedButton == 1)) return + (slotNumber != ChocolateFactoryAPI.timeTowerIndex || event.clickedButton == 1) + ) return + + // this would break ChocolateFactoryKeybinds otherwise + if (event.clickTypeEnum == GuiContainerEvent.ClickType.HOTBAR) return event.makePickblock() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt index ca4ec9705..2c0920db3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryKeybinds.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.inventory.chocolatefactory +import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiKeyPressEvent import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyClicked import at.hannibal2.skyhanni.utils.LorenzUtils @@ -40,6 +41,18 @@ object ChocolateFactoryKeybinds { } } + @SubscribeEvent + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!config.enabled) return + if (!ChocolateFactoryAPI.inChocolateFactory) return + + // needed to not send duplicate clicks via keybind feature + if (event.clickTypeEnum == GuiContainerEvent.ClickType.HOTBAR) { + event.cancel() + } + } + private fun getKey(index: Int) = when (index) { 0 -> config.key1 1 -> config.key2 |