1
0
forked from Clones/Controlify

scrollable vmouse, YACL compat, toggle sneak/sprint, 22w06a, custom name

This commit is contained in:
isXander
2023-02-08 21:54:01 +00:00
parent 6c5108469c
commit ab801e37b4
26 changed files with 400 additions and 91 deletions

View File

@ -151,7 +151,7 @@ public class Controlify {
var minecraft = Minecraft.getInstance();
if (!minecraft.mouseHandler.isMouseGrabbed())
hideMouse(currentInputMode == InputMode.CONTROLLER);
hideMouse(currentInputMode == InputMode.CONTROLLER, true);
if (minecraft.screen != null) {
ScreenProcessorProvider.provide(minecraft.screen).onInputModeChanged(currentInputMode);
}
@ -159,7 +159,7 @@ public class Controlify {
ControlifyEvents.INPUT_MODE_CHANGED.invoker().onInputModeChanged(currentInputMode);
}
public void hideMouse(boolean hide) {
public void hideMouse(boolean hide, boolean moveMouse) {
var minecraft = Minecraft.getInstance();
GLFW.glfwSetInputMode(
minecraft.getWindow().getWindow(),
@ -170,7 +170,7 @@ public class Controlify {
);
if (minecraft.screen != null) {
var mouseHandlerAccessor = (MouseHandlerAccessor) minecraft.mouseHandler;
if (hide && !virtualMouseHandler().isVirtualMouseEnabled()) {
if (hide && !virtualMouseHandler().isVirtualMouseEnabled() && moveMouse) {
// stop mouse hovering over last element before hiding cursor but don't actually move it
// so when the user switches back to mouse it will be in the same place
mouseHandlerAccessor.invokeOnMove(minecraft.getWindow().getWindow(), -50, -50);