From 1ec3fad756813a6889746034d1710ffb175ce9b1 Mon Sep 17 00:00:00 2001 From: martimavocado <39881008+martimavocado@users.noreply.github.com> Date: Wed, 14 Feb 2024 19:12:11 +0000 Subject: Add auto mouse unlocking on plot teleport. #991 --- src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt index d0c30af92..b7dd83d5f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString @@ -24,6 +25,12 @@ object LockMouseLook { } } + @SubscribeEvent + fun onChat (event: LorenzChatEvent) { + if (!event.message.startsWith("§aTeleported you to §r§aPlot")) return + if (lockedMouse) toggleLock() + } + fun toggleLock() { val gameSettings = Minecraft.getMinecraft().gameSettings ?: return lockedMouse = !lockedMouse -- cgit