diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-11 11:20:50 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-11 11:20:50 +0200 |
commit | 8527d7555ea16becbcfe949413eabfd41c8400c4 (patch) | |
tree | 8d1b52953a46c71c02ff626c2ed7420ffbe2310f /src | |
parent | 5758183af143a62acf0ac8779bbe8d66e679ed11 (diff) | |
download | skyhanni-8527d7555ea16becbcfe949413eabfd41c8400c4.tar.gz skyhanni-8527d7555ea16becbcfe949413eabfd41c8400c4.tar.bz2 skyhanni-8527d7555ea16becbcfe949413eabfd41c8400c4.zip |
code cleanup and split merged if into 2 ifs to not have to call open inventory name when the feature is disabled.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt index f96405aad..a472d4b90 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.inventory import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -11,9 +12,10 @@ class ShiftClickEquipment { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { - if (event.gui !is GuiChest) return + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.inventory.shiftClickForEquipment) return - val chestName = InventoryUtils.openInventoryName() + if (event.gui !is GuiChest) return val slot = event.slot ?: return @@ -21,15 +23,16 @@ class ShiftClickEquipment { if (slot.stack == null) return - if (SkyHanniMod.feature.inventory.shiftClickForEquipment && chestName.startsWith("Your Equipment")) { - Minecraft.getMinecraft().playerController.windowClick( - event.container.windowId, - event.slot.slotNumber, - event.clickedButton, - 1, - Minecraft.getMinecraft().thePlayer - ) - event.isCanceled = true - } + val chestName = InventoryUtils.openInventoryName() + if (!chestName.startsWith("Your Equipment")) return + + event.isCanceled = true + Minecraft.getMinecraft().playerController.windowClick( + event.container.windowId, + event.slot.slotNumber, + event.clickedButton, + 1, + Minecraft.getMinecraft().thePlayer + ) } }
\ No newline at end of file |