diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-01 23:05:53 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-01 23:05:53 +0100 |
commit | ad12389a72e0b65103cb256a8e4a0f13d066bc59 (patch) | |
tree | 458a67c67d08f96a459529b6dd08e5db4aa460ac /src/main/java/at/hannibal2 | |
parent | 1d4e3a54c036dd3bde950f3b505d1650160c19d6 (diff) | |
download | skyhanni-ad12389a72e0b65103cb256a8e4a0f13d066bc59.tar.gz skyhanni-ad12389a72e0b65103cb256a8e4a0f13d066bc59.tar.bz2 skyhanni-ad12389a72e0b65103cb256a8e4a0f13d066bc59.zip |
Reset mouse sensitivity back to 100% if you log off with lock mouse look enabled.
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt | 10 |
1 files changed, 8 insertions, 2 deletions
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 +}
|