aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/commands
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-03-07 21:46:17 +1100
committerGitHub <noreply@github.com>2024-03-07 11:46:17 +0100
commit7facd340b6e51d862a9e32977e56a7b0f69f3da0 (patch)
tree977d9d9c01518f660ed1b461e1ff2d3fc51d2612 /src/main/java/at/hannibal2/skyhanni/features/commands
parent1181ef837104b4a5f68de6cf5793b21ad7573e03 (diff)
downloadskyhanni-7facd340b6e51d862a9e32977e56a7b0f69f3da0.tar.gz
skyhanni-7facd340b6e51d862a9e32977e56a7b0f69f3da0.tar.bz2
skyhanni-7facd340b6e51d862a9e32977e56a7b0f69f3da0.zip
Backend: Use less forge events (#1085)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/commands')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt
index ff3b4fac3..7671ef5a4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/WikiManager.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.commands
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.events.GuiKeyPressEvent
import at.hannibal2.skyhanni.events.MessageSendToServerEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -11,9 +12,7 @@ import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import net.minecraft.client.gui.inventory.GuiContainer
import net.minecraft.item.ItemStack
-import net.minecraftforge.client.event.GuiScreenEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.net.URLEncoder
@@ -58,11 +57,10 @@ object WikiManager {
}
@SubscribeEvent
- fun onKeybind(event: GuiScreenEvent.KeyboardInputEvent.Post) {
+ fun onKeybind(event: GuiKeyPressEvent) {
if (!LorenzUtils.inSkyBlock) return
- val gui = event.gui as? GuiContainer ?: return
- if (NEUItems.neuHasFocus()) return // because good heavens if this worked on neuitems...
- val stack = gui.slotUnderMouse?.stack ?: return
+ if (NEUItems.neuHasFocus()) return
+ val stack = event.guiContainer.slotUnderMouse?.stack ?: return
if (!config.wikiKeybind.isKeyHeld()) return
wikiTheItem(stack, config.menuOpenWiki)