diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/misc/HarpKeybinds.kt) | 20 |
3 files changed, 26 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 6ef789465..946f41282 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -374,7 +374,7 @@ class SkyHanniMod { loadModule(GriffinPetWarning()) loadModule(BestiaryData) loadModule(KingTalismanHelper()) - loadModule(HarpKeybinds()) + loadModule(HarpFeatures()) loadModule(EnderNodeTracker()) loadModule(CompactBestiaryChatMessage()) loadModule(WatchdogHider()) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index a97fe1afe..353d99b59 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -799,11 +799,16 @@ public class MiscConfig { public boolean patcherSendCoordWaypoint = false; @Expose - @ConfigOption(name = "Harp Keybinds", desc = "In Melodys Harp, press buttons with your number row on the keyboard instead of clicking.") + @ConfigOption(name = "Harp Keybinds", desc = "In Melody's Harp, press buttons with your number row on the keyboard instead of clicking.") @ConfigEditorBoolean public boolean harpKeybinds = false; @Expose + @ConfigOption(name = "Harp Numbers", desc = "In Melody's Harp, show buttons as stack size (intended to be used with Harp Keybinds).") + @ConfigEditorBoolean + public boolean harpNumbers = false; + + @Expose @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") @ConfigEditorBoolean public boolean configButtonOnPause = true; diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpKeybinds.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt index 5ca0e6239..749fb8a64 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpKeybinds.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt @@ -1,18 +1,20 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils.openInventoryName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest +import net.minecraft.item.Item import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard import kotlin.time.Duration.Companion.milliseconds // Delaying key presses by 300ms comes from NotEnoughUpdates -class HarpKeybinds { +class HarpFeatures { private var lastClick = SimpleTimeMark.farPast() private val keys = listOf( @@ -25,6 +27,8 @@ class HarpKeybinds { Keyboard.KEY_7 ) + private val buttonColors = listOf('d', 'e', 'a', '2', '5', '9', 'b') + @SubscribeEvent fun onGui(event: GuiScreenEvent) { if (!LorenzUtils.inSkyBlock) return @@ -48,4 +52,18 @@ class HarpKeybinds { } } } + + @SubscribeEvent + fun onRenderItemTip(event: RenderItemTipEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!SkyHanniMod.feature.misc.harpNumbers) return + if (!openInventoryName().startsWith("Harp")) return + if (Item.getIdFromItem(event.stack.item) != 159) return // Stained hardened clay item id = 159 + + val index = + buttonColors.indexOfFirst { it == event.stack.displayName[1] } // Example: §9| §7Click! will select the 9 + if (index == -1) return // this should never happen unless there's an update + + event.stackTip = (index + 1).toString() + } }
\ No newline at end of file |