From 04bb7a6965587a1a1b7f65da8f7743092dd8248d Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 3 Aug 2023 15:31:53 +0200 Subject: Added dev options to show slot number on key press --- .../hannibal2/skyhanni/config/features/DevConfig.java | 5 +++++ .../at/hannibal2/skyhanni/test/TestShowSlotNumber.kt | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java index 6c42d1e82..459eb65a6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java @@ -81,6 +81,11 @@ public class DevConfig { @ConfigAccordionId(id = 0) public boolean highlightMissingRepo = false; + @Expose + @ConfigOption(name = "Slot Number", desc = "Show slot number in inventory while pressing this key.") + @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE) + public int showSlotNumberKey = Keyboard.KEY_NONE; + @ConfigOption(name = "Parkour Waypoints", desc = "") @Accordion @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt new file mode 100644 index 000000000..be202e20d --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/TestShowSlotNumber.kt @@ -0,0 +1,17 @@ +package at.hannibal2.skyhanni.test + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import org.lwjgl.input.Keyboard + +class TestShowSlotNumber { + + @SubscribeEvent + fun onRenderItemTip(event: RenderInventoryItemTipEvent) { + if (Keyboard.isKeyDown(SkyHanniMod.feature.dev.showSlotNumberKey)) { + val slotIndex = event.slot.slotIndex + event.stackTip = "$slotIndex" + } + } +} -- cgit