From f958a2b1b65a8733895b85b480ad451512d33393 Mon Sep 17 00:00:00 2001 From: isXander Date: Sun, 7 May 2023 12:41:20 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Remove=20VMouse=20Escape?= =?UTF-8?q?=20in=20favour=20of=20existing=20GUI=20Back=20bind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/dev/isxander/controlify/Controlify.java | 5 ++--- .../isxander/controlify/bindings/ControllerBindings.java | 7 +------ .../controlify/virtualmouse/VirtualMouseHandler.java | 6 ++---- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/java/dev/isxander/controlify/Controlify.java b/src/main/java/dev/isxander/controlify/Controlify.java index 80c3835..9f6c43e 100644 --- a/src/main/java/dev/isxander/controlify/Controlify.java +++ b/src/main/java/dev/isxander/controlify/Controlify.java @@ -267,13 +267,12 @@ public class Controlify implements ControlifyApi { return; } + this.virtualMouseHandler().handleControllerInput(controller); if (minecraft.screen != null) { ScreenProcessorProvider.provide(minecraft.screen).onControllerUpdate(controller); - } - if (minecraft.level != null) { + } else if (minecraft.level != null) { this.inGameInputHandler().ifPresent(InGameInputHandler::inputTick); } - this.virtualMouseHandler().handleControllerInput(controller); ControlifyEvents.ACTIVE_CONTROLLER_TICKED.invoker().onControllerStateUpdate(controller); } diff --git a/src/main/java/dev/isxander/controlify/bindings/ControllerBindings.java b/src/main/java/dev/isxander/controlify/bindings/ControllerBindings.java index 490375b..661d632 100644 --- a/src/main/java/dev/isxander/controlify/bindings/ControllerBindings.java +++ b/src/main/java/dev/isxander/controlify/bindings/ControllerBindings.java @@ -60,7 +60,7 @@ public class ControllerBindings { VMOUSE_MOVE_UP, VMOUSE_MOVE_DOWN, VMOUSE_MOVE_LEFT, VMOUSE_MOVE_RIGHT, VMOUSE_LCLICK, VMOUSE_RCLICK, VMOUSE_SHIFT_CLICK, VMOUSE_SCROLL_UP, VMOUSE_SCROLL_DOWN, - VMOUSE_ESCAPE, VMOUSE_SHIFT, + VMOUSE_SHIFT, VMOUSE_TOGGLE, GUI_NAVI_UP, GUI_NAVI_DOWN, GUI_NAVI_LEFT, GUI_NAVI_RIGHT, CYCLE_OPT_FORWARD, CYCLE_OPT_BACKWARD, @@ -287,11 +287,6 @@ public class ControllerBindings { .defaultBind(GamepadBinds.RIGHT_STICK_BACKWARD) .category(VMOUSE_CATEGORY) .build()); - register(VMOUSE_ESCAPE = ControllerBindingBuilder.create(controller) - .identifier("controlify", "vmouse_escape") - .defaultBind(GamepadBinds.B_BUTTON) - .category(VMOUSE_CATEGORY) - .build()); register(VMOUSE_SHIFT = ControllerBindingBuilder.create(controller) .identifier("controlify", "vmouse_shift") .defaultBind(GamepadBinds.LEFT_STICK_PRESS) diff --git a/src/main/java/dev/isxander/controlify/virtualmouse/VirtualMouseHandler.java b/src/main/java/dev/isxander/controlify/virtualmouse/VirtualMouseHandler.java index 826aca6..87617a6 100644 --- a/src/main/java/dev/isxander/controlify/virtualmouse/VirtualMouseHandler.java +++ b/src/main/java/dev/isxander/controlify/virtualmouse/VirtualMouseHandler.java @@ -114,10 +114,8 @@ public class VirtualMouseHandler { mouseHandler.invokeOnPress(minecraft.getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_LEFT, GLFW.GLFW_RELEASE, 0); } - if (controller.bindings().VMOUSE_ESCAPE.justPressed()) { - keyboardHandler.invokeKeyPress(minecraft.getWindow().getWindow(), GLFW.GLFW_KEY_ESCAPE, 0, GLFW.GLFW_PRESS, 0); - } else if (controller.bindings().VMOUSE_ESCAPE.justReleased()) { - keyboardHandler.invokeKeyPress(minecraft.getWindow().getWindow(), GLFW.GLFW_KEY_ESCAPE, 0, GLFW.GLFW_RELEASE, 0); + if (controller.bindings().GUI_BACK.justPressed() && minecraft.screen != null) { + minecraft.screen.onClose(); } }