aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt29
3 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index cb85a3fd6..ce7ad3490 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -181,6 +181,7 @@ import at.hannibal2.skyhanni.features.misc.HideDamageSplash
import at.hannibal2.skyhanni.features.misc.InGameDateDisplay
import at.hannibal2.skyhanni.features.misc.JoinCrystalHollows
import at.hannibal2.skyhanni.features.misc.LimboTimeTracker
+import at.hannibal2.skyhanni.features.misc.LockMouseLook
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.features.misc.MiscFeatures
import at.hannibal2.skyhanni.features.misc.MovementSpeedDisplay
@@ -603,6 +604,7 @@ class SkyHanniMod {
loadModule(LimboTimeTracker())
loadModule(PartyMemberOutlines())
loadModule(ShiftClickEquipment())
+ loadModule(LockMouseLook)
init()
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 1479e5037..ca6018ad6 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -24,6 +24,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.CaptureFarmingGear
import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI
import at.hannibal2.skyhanni.features.minion.MinionFeatures
import at.hannibal2.skyhanni.features.misc.CollectionTracker
+import at.hannibal2.skyhanni.features.misc.LockMouseLook
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostUtil
@@ -164,6 +165,10 @@ object Commands {
// "Copies the translation for a given message to your clipboard. " +
// "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)"
+ ) { LockMouseLook.toggleLock() }
}
private fun usersBugFix() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt
new file mode 100644
index 000000000..8058ec2c0
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LockMouseLook.kt
@@ -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.")
+ }
+ }
+} \ No newline at end of file