diff options
author | NetheriteMiner <88792142+NetheriteMiner@users.noreply.github.com> | 2023-08-10 12:10:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-10 18:10:57 +0200 |
commit | f4f5e3713d1f084cf26aa8abf3df4d3647f7b0ef (patch) | |
tree | 6580c02127e69bb536997b67433a6d55b5d994e5 /src/main/java/at/hannibal2/skyhanni/features/misc | |
parent | 9e474fb8fe76b02960b3743e31015018e8666b7f (diff) | |
download | skyhanni-f4f5e3713d1f084cf26aa8abf3df4d3647f7b0ef.tar.gz skyhanni-f4f5e3713d1f084cf26aa8abf3df4d3647f7b0ef.tar.bz2 skyhanni-f4f5e3713d1f084cf26aa8abf3df4d3647f7b0ef.zip |
Merge pull request #372
* Add Harp Numbers
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-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 |
1 files changed, 19 insertions, 1 deletions
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 |