From ad12389a72e0b65103cb256a8e4a0f13d066bc59 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 1 Nov 2023 23:05:53 +0100 Subject: Reset mouse sensitivity back to 100% if you log off with lock mouse look enabled. --- .../java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (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 932056b9d..8873c7402 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt @@ -8,10 +8,16 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object LockMouseLook { private var lockedMouse = false private var oldSensitivity = 0F + private val lockedPosition = -1F / 3F @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { if (lockedMouse) toggleLock() + val gameSettings = Minecraft.getMinecraft().gameSettings + if (gameSettings.mouseSensitivity == lockedPosition) { + gameSettings.mouseSensitivity = 0.5f + LorenzUtils.chat("§e[SkyHanni] §bReset your mouse sensitivity to 100%.") + } } fun toggleLock() { @@ -20,11 +26,11 @@ object LockMouseLook { val gameSettings = Minecraft.getMinecraft().gameSettings if (lockedMouse) { oldSensitivity = gameSettings.mouseSensitivity - gameSettings.mouseSensitivity = -1F / 3F + gameSettings.mouseSensitivity = lockedPosition LorenzUtils.chat("§e[SkyHanni] §bMouse rotation is now locked. Type /shmouselock to unlock your rotation") } else { gameSettings.mouseSensitivity = oldSensitivity LorenzUtils.chat("§e[SkyHanni] §bMouse rotation is now unlocked.") } } -} \ No newline at end of file +} -- cgit