From 0837516809ab655ec814f90413fa213cffd5cfbc Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sun, 12 Nov 2023 13:01:27 +0100 Subject: [PATCH] xray working far enough --- src/client/java/de/cscherr/mcpht/XRay.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/client/java/de/cscherr/mcpht/XRay.java b/src/client/java/de/cscherr/mcpht/XRay.java index aa05221..f9a77a9 100644 --- a/src/client/java/de/cscherr/mcpht/XRay.java +++ b/src/client/java/de/cscherr/mcpht/XRay.java @@ -83,18 +83,20 @@ public class XRay { private static KeyBinding toggleKey; public void init() { - toggleKey = KeyBindingHelper.registerKeyBinding( new KeyBinding( + toggleKey = KeyBindingHelper.registerKeyBinding(new KeyBinding( "key.mcpht.toggleXray", // Translation of name InputUtil.Type.KEYSYM, // Type: MOUSE or KESYM (Keyboard) - GLFW.GLFW_KEY_R, // The keycode of the key (default?) + GLFW.GLFW_KEY_X, // The keycode of the key (default?) "category.mcpht.rendering" // Translation key for the keybinding category )); ClientTickEvents.END_CLIENT_TICK.register(client -> { // NOTE: IDK why we need a while here while (toggleKey.wasPressed()) { - MCPHTClient.LOGGER.info(String.format("toggle XRay: %s", MCPHTClient.XRAY.enable)); - MCPHTClient.XRAY.enable = !MCPHTClient.XRAY.enable; - MCPHTClient.MC.worldRenderer.reload(); + if (MCPHTClient.XRAY.getEnable()) { + MCPHTClient.LOGGER.info(String.format("toggle XRay: %s", MCPHTClient.XRAY.enable)); + MCPHTClient.XRAY.enable = !MCPHTClient.XRAY.enable; + MCPHTClient.MC.worldRenderer.reload(); + } } }); }