aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt35
1 files changed, 35 insertions, 0 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
new file mode 100644
index 000000000..f96405aad
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt
@@ -0,0 +1,35 @@
+package at.hannibal2.skyhanni.features.inventory
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class ShiftClickEquipment {
+
+ @SubscribeEvent
+ fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) {
+ if (event.gui !is GuiChest) return
+
+ val chestName = InventoryUtils.openInventoryName()
+
+ val slot = event.slot ?: return
+
+ if (slot.slotNumber == slot.slotIndex) return
+
+ 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
+ }
+ }
+} \ No newline at end of file