Add a config option to disable the F4 keybinding

This commit is contained in:
James Seibel
2021-08-29 21:23:16 -05:00
parent 2dcdc854e3
commit f68e6a9a13
2 changed files with 14 additions and 4 deletions
@@ -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> debugMode;
public ForgeConfigSpec.BooleanValue enableDebugKeybinding;
public ForgeConfigSpec.EnumValue<LodTemplate> lodTemplate;
public ForgeConfigSpec.EnumValue<LodDetail> 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"
@@ -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());
}