diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-08-02 10:58:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 10:58:05 +0200 |
commit | 80f09d2de3b32935f8b6646353d807f037ba25bb (patch) | |
tree | 459895ca2c5421af75fe1330fb67dd2134da42e6 /src/main/java/at/hannibal2/skyhanni/features/nether | |
parent | 5c2975024cc2fcbee159506c15acc11526044da7 (diff) | |
download | skyhanni-80f09d2de3b32935f8b6646353d807f037ba25bb.tar.gz skyhanni-80f09d2de3b32935f8b6646353d807f037ba25bb.tar.bz2 skyhanni-80f09d2de3b32935f8b6646353d807f037ba25bb.zip |
Fix: Reputation helper keybind activating while inside GUIs. (#2284)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/nether')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index 803cedb78..6e1b73cd0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -21,10 +21,13 @@ import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiInventory import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -52,7 +55,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { */ val tabListQuestPattern by RepoPattern.pattern( "crimson.reputation.tablist", - " §r§[cdea].*" + " §r§[cdea].*", ) init { @@ -143,16 +146,26 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { if (!config.enabled.get()) return if (!IslandType.CRIMSON_ISLE.isInIsland()) return - if (config.useHotkey && !config.hotkey.isKeyHeld()) { + if (config.useHotkey && !isHotkeyHeld()) { return } config.position.renderStringsAndItems( display, - posLabel = "Crimson Isle Reputation Helper" + posLabel = "Crimson Isle Reputation Helper", ) } + fun isHotkeyHeld(): Boolean { + val isAllowedGui = Minecraft.getMinecraft().currentScreen.let { + it == null || it is GuiInventory + } + if (!isAllowedGui) return false + if (NEUItems.neuHasFocus()) return false + + return config.hotkey.isKeyHeld() + } + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(2, "misc.crimsonIsleReputationHelper", "crimsonIsle.reputationHelper.enabled") @@ -193,7 +206,7 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { fun showLocations() = when (config.showLocation) { ShowLocationEntry.ALWAYS -> true - ShowLocationEntry.ONLY_HOTKEY -> config.hotkey.isKeyHeld() + ShowLocationEntry.ONLY_HOTKEY -> isHotkeyHeld() else -> false } } |