diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 4313fcb35..2201ffd8b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign import at.hannibal2.skyhanni.utils.NEUItems @@ -15,32 +15,22 @@ import net.minecraft.client.gui.inventory.GuiInventory import net.minecraft.client.renderer.GlStateManager import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import org.lwjgl.input.Keyboard import java.util.UUID class GuiEditManager { - @SubscribeEvent - fun onTick(event: LorenzTickEvent) { + fun onKeyClick(event: LorenzKeyPressEvent) { if (!LorenzUtils.inSkyBlock) return + if (isInGui()) return Minecraft.getMinecraft().currentScreen?.let { if (it !is GuiInventory && it !is GuiChest && it !is GuiEditSign) return + if (it is GuiEditSign && !it.isRancherSign()) return } - if (!Keyboard.getEventKeyState()) return - val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey() - if (SkyHanniMod.feature.gui.keyBindOpen != key) return - if (NEUItems.neuHasFocus()) return - val screen = Minecraft.getMinecraft().currentScreen - if (screen is GuiEditSign && !screen.isRancherSign()) { - return - } - - if (isInGui()) return - openGuiPositionEditor() + if (event.keyCode == SkyHanniMod.feature.gui.keyBindOpen) openGuiPositionEditor() } @SubscribeEvent(priority = EventPriority.LOWEST) |