diff --git a/src/main/java/gg/skytils/skytilsmod/mixins/transformers/util/MixinMouseHelper.java b/src/main/java/gg/skytils/skytilsmod/mixins/transformers/util/MixinMouseHelper.java
new file mode 100644
index 000000000..915d1a0b4
--- /dev/null
+++ b/src/main/java/gg/skytils/skytilsmod/mixins/transformers/util/MixinMouseHelper.java
@@ -0,0 +1,33 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2020-2023 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package gg.skytils.skytilsmod.mixins.transformers.util;
+
+import com.llamalad7.mixinextras.injector.WrapWithCondition;
+import gg.skytils.skytilsmod.mixins.hooks.util.MouseHelperHookKt;
+import net.minecraft.util.MouseHelper;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+@Mixin(MouseHelper.class)
+public class MixinMouseHelper {
+ @WrapWithCondition(method = "ungrabMouseCursor", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;setCursorPosition(II)V", remap = false))
+ private boolean shouldSetCursorPos(int newX, int newY) {
+ return MouseHelperHookKt.shouldResetMouseToCenter();
+ }
+}
diff --git a/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt
index 473a43ef4..a2a3f697d 100644
--- a/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt
+++ b/src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt
@@ -1893,7 +1893,6 @@ object Config : Vigilant(
)
var hideScoreboardScore = false
-
@Property(
type = PropertyType.SWITCH, name = "Hide Vanilla Health Display",
description = "Prevents the game from rendering the vanilla heart points.",
@@ -1971,6 +1970,13 @@ object Config : Vigilant(
)
var partyAddons = false
+ @Property(
+ type = PropertyType.SWITCH, name = "Prevent Cursor Reset",
+ description = "Prevents the cursor from resetting to the center of the screen when you open a GUI.",
+ category = "Miscellaneous", subcategory = "Quality of Life"
+ )
+ var preventCursorReset = false
+
@Property(
type = PropertyType.SWITCH, name = "Power Orb Lock",
description = "Prevents placing the power orb if the same or better power orb is within range.",
diff --git a/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/util/MouseHelperHook.kt b/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/util/MouseHelperHook.kt
new file mode 100644
index 000000000..970ceaea7
--- /dev/null
+++ b/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/util/MouseHelperHook.kt
@@ -0,0 +1,25 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2020-2023 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package gg.skytils.skytilsmod.mixins.hooks.util
+
+import gg.skytils.skytilsmod.Skytils
+
+fun shouldResetMouseToCenter(): Boolean {
+ return !Skytils.config.preventCursorReset
+}
\ No newline at end of file
diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json
index 733acbeaf..05018fa52 100644
--- a/src/main/resources/mixins.skytils.json
+++ b/src/main/resources/mixins.skytils.json
@@ -84,6 +84,7 @@
],
"verbose": true,
"client": [
- "gui.MixinGuiEditSign"
+ "gui.MixinGuiEditSign",
+ "util.MixinMouseHelper"
]
}
\ No newline at end of file