aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/makamys/lodmod/LODMod.java5
-rw-r--r--src/main/java/makamys/lodmod/renderer/LODRenderer.java37
2 files changed, 22 insertions, 20 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java
index 34a380d..6b75d7d 100644
--- a/src/main/java/makamys/lodmod/LODMod.java
+++ b/src/main/java/makamys/lodmod/LODMod.java
@@ -23,6 +23,7 @@ import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.FMLCommonHandler;
@@ -48,7 +49,6 @@ public class LODMod
public static LODRenderer renderer;
public static boolean enabled;
- public static boolean debugEnabled;
public static int chunkLoadsPerTick;
public static List<Class> blockClassBlacklist;
public static double fogStart;
@@ -65,6 +65,7 @@ public class LODMod
public static int sortFrequency;
public static int gcRate;
public static int VRAMSize;
+ public static int debugPrefix;
private File configFile;
@@ -100,7 +101,6 @@ public class LODMod
fogEnd = config.get("Fog", "fogEnd", "0.8").getDouble();
farPlaneDistanceMultiplier = config.get("Fog", "farPlaneDistanceMultiplier", "1.0").getDouble();
- debugEnabled = config.get("Debug", "enabled", false).getBoolean();
maxSimpleMeshHeight = (float)config.get("Debug", "maxSimpleMeshHeight", 1000.0).getDouble();
forceVanillaBiomeTemperature = config.get("Simple mesh generation", "forceVanillaBiomeTemperature", true).getBoolean();
@@ -115,6 +115,7 @@ public class LODMod
gcRate = config.getInt("gcRate", "render", 1, 1, Integer.MAX_VALUE, "Maximum number of meshes to relocate each frame.");
VRAMSize = config.getInt("VRAMSize", "render", 1024, 1, Integer.MAX_VALUE, "VRAM buffer size (MB).");
enableFog = config.getBoolean("enableFog", "render", true, "");
+ debugPrefix = config.getInt("debugPrefix", "debug", Keyboard.KEY_F4, -1, Integer.MAX_VALUE, "This key has to be held down while pressing the debug keybinds. LWJGL keycode. Setting this to 0 will make the keybinds usable without holding anything else down. Setting this to -1 will disable debug keybinds entirely.");
if(config.hasChanged()) {
config.save();
diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
index c20699b..3420c34 100644
--- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java
+++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
@@ -122,7 +122,7 @@ public class LODRenderer {
if(hasInited) {
mainLoop();
- if(LODMod.debugEnabled && Minecraft.getMinecraft().currentScreen == null) {
+ if(Minecraft.getMinecraft().currentScreen == null) {
handleKeyboard();
}
if(frameCount % 2 == 0) {
@@ -256,24 +256,25 @@ public class LODRenderer {
}
private void handleKeyboard() {
- if(Keyboard.isKeyDown(Keyboard.KEY_F) && !wasDown[Keyboard.KEY_F]) {
- rendererActive = !rendererActive;
- }
- if(Keyboard.isKeyDown(Keyboard.KEY_V) && !wasDown[Keyboard.KEY_V]) {
- renderWorld = !renderWorld;
- }
- if(Keyboard.isKeyDown(Keyboard.KEY_R) && !wasDown[Keyboard.KEY_R]) {
- loadShader();
- }
- if(Keyboard.isKeyDown(Keyboard.KEY_M) && !wasDown[Keyboard.KEY_M]) {
- showMemoryDebugger = !showMemoryDebugger;
- //LODChunk chunk = getLODChunk(9, -18);
- //setMeshVisible(chunk.chunkMeshes[7], false, true);
- //freezeMeshes = false;
- //chunk.chunkMeshes[7].quadCount = 256;
- //setMeshVisible(chunk.chunkMeshes[7], true, true);
+ if(LODMod.debugPrefix == 0 || (LODMod.debugPrefix != -1 && Keyboard.isKeyDown(LODMod.debugPrefix))) {
+ if(Keyboard.isKeyDown(Keyboard.KEY_F) && !wasDown[Keyboard.KEY_F]) {
+ rendererActive = !rendererActive;
+ }
+ if(Keyboard.isKeyDown(Keyboard.KEY_V) && !wasDown[Keyboard.KEY_V]) {
+ renderWorld = !renderWorld;
+ }
+ if(Keyboard.isKeyDown(Keyboard.KEY_R) && !wasDown[Keyboard.KEY_R]) {
+ loadShader();
+ }
+ if(Keyboard.isKeyDown(Keyboard.KEY_M) && !wasDown[Keyboard.KEY_M]) {
+ showMemoryDebugger = !showMemoryDebugger;
+ //LODChunk chunk = getLODChunk(9, -18);
+ //setMeshVisible(chunk.chunkMeshes[7], false, true);
+ //freezeMeshes = false;
+ //chunk.chunkMeshes[7].quadCount = 256;
+ //setMeshVisible(chunk.chunkMeshes[7], true, true);
+ }
}
-
for(int i = 0; i < 256; i++) {
wasDown[i] = Keyboard.isKeyDown(i);
}