-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See #350 Original Feature was Co-authored-by: Moulberry <james.jenour@protonmail.com>
- Loading branch information
1 parent
3046eb7
commit 469d221
Showing
4 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/gg/skytils/skytilsmod/mixins/transformers/util/MixinMouseHelper.java
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,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 <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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(); | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/util/MouseHelperHook.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,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 <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package gg.skytils.skytilsmod.mixins.hooks.util | ||
|
||
import gg.skytils.skytilsmod.Skytils | ||
|
||
fun shouldResetMouseToCenter(): Boolean { | ||
return !Skytils.config.preventCursorReset | ||
} |
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 |
---|---|---|
|
@@ -84,6 +84,7 @@ | |
], | ||
"verbose": true, | ||
"client": [ | ||
"gui.MixinGuiEditSign" | ||
"gui.MixinGuiEditSign", | ||
"util.MixinMouseHelper" | ||
] | ||
} |