aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2023-10-11 11:18:17 +0200
committerGitHub <noreply@github.com>2023-10-11 11:18:17 +0200
commit5758183af143a62acf0ac8779bbe8d66e679ed11 (patch)
tree920e1561708a24cc464789aa12a2dfac4800b873 /src/main/java/at/hannibal2/skyhanni/features
parent72e03947031b49135dc6a4cc97ef6b79c05def76 (diff)
downloadskyhanni-5758183af143a62acf0ac8779bbe8d66e679ed11.tar.gz
skyhanni-5758183af143a62acf0ac8779bbe8d66e679ed11.tar.bz2
skyhanni-5758183af143a62acf0ac8779bbe8d66e679ed11.zip
Feature: Make normal clicks to shift clicks in equipment inventory (#519)
Added Shift Click Equipment. #519
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