From f68e6a9a13ed1a9a917fad8e41a73fa1dd8e9dd6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 29 Aug 2021 21:23:16 -0500 Subject: [PATCH] Add a config option to disable the F4 keybinding --- src/main/java/com/seibel/lod/handlers/LodConfig.java | 11 +++++++++-- src/main/java/com/seibel/lod/proxy/ClientProxy.java | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/seibel/lod/handlers/LodConfig.java b/src/main/java/com/seibel/lod/handlers/LodConfig.java index 67d67570b..1c6702443 100644 --- a/src/main/java/com/seibel/lod/handlers/LodConfig.java +++ b/src/main/java/com/seibel/lod/handlers/LodConfig.java @@ -44,7 +44,7 @@ import net.minecraftforge.fml.config.ModConfig; * This handles any configuration the user has access to. * * @author James Seibel - * @version 8-10-2021 + * @version 8-29-2021 */ @Mod.EventBusSubscriber public class LodConfig @@ -59,6 +59,8 @@ public class LodConfig public ForgeConfigSpec.EnumValue debugMode; + public ForgeConfigSpec.BooleanValue enableDebugKeybinding; + public ForgeConfigSpec.EnumValue lodTemplate; public ForgeConfigSpec.EnumValue maxDrawDetail; @@ -85,6 +87,7 @@ public class LodConfig public ForgeConfigSpec.DoubleValue saturationMultiplier; + Client(ForgeConfigSpec.Builder builder) { builder.comment(ModInfo.MODNAME + " configuration settings").push("client"); @@ -114,12 +117,16 @@ public class LodConfig debugMode = builder .comment("\n\n" - + " This can be changed using the F4 key. \n" + " " + DebugMode.OFF.toString() + ": LODs will draw with their normal colors. \n" + " " + DebugMode.SHOW_DETAIL.toString() + ": LOD colors will be based on their detail. \n" + " " + DebugMode.SHOW_DETAIL_WIREFRAME.toString() + ": LOD colors will be based on their detail, drawn with wireframe. \n") .defineEnum("debugMode", DebugMode.OFF); + enableDebugKeybinding = builder + .comment("\n\n" + + " If true the F4 key can be used to cycle through the different debug modes. \n") + .define("enableDebugKeybinding", false); + lodTemplate = builder .comment("\n\n" + " How should the LODs be drawn? \n" diff --git a/src/main/java/com/seibel/lod/proxy/ClientProxy.java b/src/main/java/com/seibel/lod/proxy/ClientProxy.java index d978ba1f2..90065e129 100644 --- a/src/main/java/com/seibel/lod/proxy/ClientProxy.java +++ b/src/main/java/com/seibel/lod/proxy/ClientProxy.java @@ -19,6 +19,7 @@ package com.seibel.lod.proxy; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.lwjgl.glfw.GLFW; import com.seibel.lod.builders.LodBufferBuilder; import com.seibel.lod.builders.LodBuilder; @@ -171,6 +172,8 @@ public class ClientProxy LodConfig.CLIENT.lodDistanceCalculatorType.set(DistanceCalculatorType.LINEAR); LodConfig.CLIENT.lodQuality.set(3); LodConfig.CLIENT.allowUnstableFeatureGeneration.set(false); + + LodConfig.CLIENT.enableDebugKeybinding.set(true); } @@ -254,8 +257,8 @@ public class ClientProxy @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { - //f4 is key 293, the 1 action mean that the key just got pressed - if(event.getKey() == 293 && event.getAction() == 1) + if(LodConfig.CLIENT.enableDebugKeybinding.get() + && event.getKey() == GLFW.GLFW_KEY_F4 && event.getAction() == GLFW.GLFW_PRESS) { LodConfig.CLIENT.debugMode.set(LodConfig.CLIENT.debugMode.get().getNext()); }