From 8116fb8434a724b67be01e1369ef902b865d5c49 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:10:05 +0200 Subject: code cleanup --- .../java/at/hannibal2/skyhanni/config/commands/Commands.kt | 4 ++-- .../at/hannibal2/skyhanni/features/misc/LockMouseLook.kt | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index ca6018ad6..5eccdf488 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -166,8 +166,8 @@ object Commands { // "Language codes are at the end of the translation when you click on a message." // ) { Translator.fromEnglish(it) } registerCommand( - "shmouselock", - "Lock/Unlock the mouse so it will no longer rotate the player (for farming)" + "shmouselock", + "Lock/Unlock the mouse so it will no longer rotate the player (for farming)" ) { LockMouseLook.toggleLock() } } 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 8058ec2c0..932056b9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt @@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object LockMouseLook { private var lockedMouse = false - private var oldSensitivity = 0F; + private var oldSensitivity = 0F @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { @@ -17,13 +17,14 @@ object LockMouseLook { fun toggleLock() { lockedMouse = !lockedMouse + val gameSettings = Minecraft.getMinecraft().gameSettings if (lockedMouse) { - oldSensitivity = Minecraft.getMinecraft().gameSettings.mouseSensitivity; - Minecraft.getMinecraft().gameSettings.mouseSensitivity = -1F/3F; - LorenzUtils.chat("§b[SkyHanni] Mouse rotation is now locked. Type /shmouselock to unlock your rotation") + oldSensitivity = gameSettings.mouseSensitivity + gameSettings.mouseSensitivity = -1F / 3F + LorenzUtils.chat("§e[SkyHanni] §bMouse rotation is now locked. Type /shmouselock to unlock your rotation") } else { - Minecraft.getMinecraft().gameSettings.mouseSensitivity = oldSensitivity - LorenzUtils.chat("§b[SkyHanni] Mouse rotation is now unlocked.") + gameSettings.mouseSensitivity = oldSensitivity + LorenzUtils.chat("§e[SkyHanni] §bMouse rotation is now unlocked.") } } } \ No newline at end of file -- cgit