-
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add /shmouselock command to lock mouse rotation for farming (#470)
Add /shmouselock command to lock mouse rotation for farming #470
- Loading branch information
1 parent
75624d6
commit 64d038a
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package at.hannibal2.skyhanni.features.misc | ||
|
||
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent | ||
import at.hannibal2.skyhanni.utils.LorenzUtils | ||
import net.minecraft.client.Minecraft | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent | ||
|
||
object LockMouseLook { | ||
private var lockedMouse = false | ||
private var oldSensitivity = 0F; | ||
|
||
@SubscribeEvent | ||
fun onWorldChange(event: LorenzWorldChangeEvent) { | ||
if (lockedMouse) toggleLock() | ||
} | ||
|
||
fun toggleLock() { | ||
lockedMouse = !lockedMouse | ||
|
||
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") | ||
} else { | ||
Minecraft.getMinecraft().gameSettings.mouseSensitivity = oldSensitivity | ||
LorenzUtils.chat("§b[SkyHanni] Mouse rotation is now unlocked.") | ||
} | ||
} | ||
} |