diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2023-10-11 11:18:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 11:18:17 +0200 |
commit | 5758183af143a62acf0ac8779bbe8d66e679ed11 (patch) | |
tree | 920e1561708a24cc464789aa12a2dfac4800b873 /src/main | |
parent | 72e03947031b49135dc6a4cc97ef6b79c05def76 (diff) | |
download | skyhanni-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')
3 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index c7bb40f39..2ef4de8e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -152,6 +152,7 @@ import at.hannibal2.skyhanni.features.inventory.RngMeterInventory import at.hannibal2.skyhanni.features.inventory.SackDisplay import at.hannibal2.skyhanni.features.inventory.SkyBlockLevelGuideHelper import at.hannibal2.skyhanni.features.inventory.StatsTuning +import at.hannibal2.skyhanni.features.inventory.ShiftClickEquipment import at.hannibal2.skyhanni.features.itemabilities.FireVeilWandParticles import at.hannibal2.skyhanni.features.itemabilities.abilitycooldown.ItemAbilityCooldown import at.hannibal2.skyhanni.features.mining.HighlightMiningCommissionMobs @@ -589,6 +590,7 @@ class SkyHanniMod { loadModule(SkyBlockKickDuration()) loadModule(LimboTimeTracker()) loadModule(PartyMemberOutlines()) + loadModule(ShiftClickEquipment()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java index 993746999..adf684a84 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/InventoryConfig.java @@ -418,5 +418,10 @@ public class InventoryConfig { @FeatureToggle public boolean highlightAuctions = true; + @Expose + @ConfigOption(name = "Shift Click Equipment", desc = "Makes normal clicks to shift clicks in equipment inventory") + @ConfigEditorBoolean + @FeatureToggle + public boolean shiftClickForEquipment = false; } 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 |