From 31717ad2020d909a685c298b8456a72459161ba5 Mon Sep 17 00:00:00 2001 From: tom lee Date: Sun, 6 Feb 2022 14:57:43 +0800 Subject: [PATCH] Changed how key events work --- .../com/seibel/lod/core/api/ClientApi.java | 28 +++++++++++++++++-- .../com/seibel/lod/core/api/EventApi.java | 16 ----------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/api/ClientApi.java b/src/main/java/com/seibel/lod/core/api/ClientApi.java index 6bf39666e..89633d414 100644 --- a/src/main/java/com/seibel/lod/core/api/ClientApi.java +++ b/src/main/java/com/seibel/lod/core/api/ClientApi.java @@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.lwjgl.glfw.GLFW; import com.seibel.lod.core.ModInfo; import com.seibel.lod.core.enums.config.DistanceGenerationMode; @@ -105,8 +106,6 @@ public class ClientApi clientChunkLoad.end("clientChunkLoad"); } - //private HashSet lastFrame = new HashSet(); - public void renderLods(Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks) { // comment out when creating a release @@ -249,7 +248,30 @@ public class ClientApi CONFIG.client().advanced().debugging().setDebugKeybindingsEnabled(true); } - + + //=================// + // DUBUG USE // + //=================// + // Trigger once on key press, with CLIENT PLAYER. + public void keyPressedEvent(int glfwKey) { + ClientApi.LOGGER.info("DEBUG: Key Pressed: {}",glfwKey); + + if (glfwKey == GLFW.GLFW_KEY_F8) { + CONFIG.client().advanced().debugging() + .setDebugMode(CONFIG.client().advanced().debugging().getDebugMode().getNext()); + MC.sendChatMessage("F8: Set debug mode to " + CONFIG.client().advanced().debugging().getDebugMode()); + } + + if (glfwKey == GLFW.GLFW_KEY_F6) { + CONFIG.client().advanced().debugging() + .setDrawLods(!CONFIG.client().advanced().debugging().getDrawLods()); + MC.sendChatMessage("F6: Set rendering to " + CONFIG.client().advanced().debugging().getDrawLods()); + } + + + + + } diff --git a/src/main/java/com/seibel/lod/core/api/EventApi.java b/src/main/java/com/seibel/lod/core/api/EventApi.java index 19a6777d0..ae1c1fcda 100644 --- a/src/main/java/com/seibel/lod/core/api/EventApi.java +++ b/src/main/java/com/seibel/lod/core/api/EventApi.java @@ -193,22 +193,6 @@ public class EventApi { // Misc Events // // =============// - public void onKeyInput(int key, int keyAction) { - if (CONFIG.client().advanced().debugging().getDebugKeybindingsEnabled()) { - if (key == GLFW.GLFW_KEY_F8 && keyAction == GLFW.GLFW_PRESS) { - CONFIG.client().advanced().debugging() - .setDebugMode(CONFIG.client().advanced().debugging().getDebugMode().getNext()); - MC.sendChatMessage("F8: Set debug mode " + CONFIG.client().advanced().debugging().getDebugMode()); - } - - if (key == GLFW.GLFW_KEY_F6 && keyAction == GLFW.GLFW_PRESS) { - CONFIG.client().advanced().debugging() - .setDrawLods(!CONFIG.client().advanced().debugging().getDrawLods()); - MC.sendChatMessage("F6: Set rendering " + CONFIG.client().advanced().debugging().getDrawLods()); - } - } - } - // NOTE: This is being called from Render Thread. /** Re-centers the given LodDimension if it needs to be. */ public void playerMoveEvent(LodDimension lodDim) {