aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys
diff options
context:
space:
mode:
authorFalsePattern <30945458+FalsePattern@users.noreply.github.com>2022-06-27 10:47:51 +0200
committerFalsePattern <30945458+FalsePattern@users.noreply.github.com>2022-06-27 10:47:51 +0200
commit76eb72f6dd329e726f33b0557f4743869e40a032 (patch)
tree7c6b73085205ff0109ae0041d29d4102777e8f0d /src/main/java/makamys
parent1600a672fcd82be6b8c4ebe48b017cbfd27220ec (diff)
downloadNeodymium-76eb72f6dd329e726f33b0557f4743869e40a032.tar.gz
Neodymium-76eb72f6dd329e726f33b0557f4743869e40a032.tar.bz2
Neodymium-76eb72f6dd329e726f33b0557f4743869e40a032.zip
integrate the debug text with the forge debug text rendering system
Diffstat (limited to 'src/main/java/makamys')
-rw-r--r--src/main/java/makamys/neodymium/Config.java4
-rw-r--r--src/main/java/makamys/neodymium/Neodymium.java24
2 files changed, 13 insertions, 15 deletions
diff --git a/src/main/java/makamys/neodymium/Config.java b/src/main/java/makamys/neodymium/Config.java
index badfcce..8594dd5 100644
--- a/src/main/java/makamys/neodymium/Config.java
+++ b/src/main/java/makamys/neodymium/Config.java
@@ -58,8 +58,8 @@ public class Config {
public static int maxMeshesPerFrame;
@ConfigInt(cat="debug", def=Keyboard.KEY_F4, min=-1, max=Integer.MAX_VALUE, com="The LWJGL keycode of the key that has to be held down while pressing the debug keybinds. Setting this to 0 will make the keybinds usable without holding anything else down. Setting this to -1 will disable debug keybinds entirely.")
public static int debugPrefix;
- @ConfigInt(cat="debug", def=110, min=-1, max=Integer.MAX_VALUE, com="The Y position of the first line of the debug info in the F3 overlay. Set this to -1 to disable showing that info.")
- public static int debugInfoStartY;
+ @ConfigBoolean(cat="debug", def=true, com="Set this to false to stop showing the debug info in the F3 overlay.")
+ public static boolean showDebugInfo;
@ConfigBoolean(cat="debug", def=false)
public static boolean wireframe;
diff --git a/src/main/java/makamys/neodymium/Neodymium.java b/src/main/java/makamys/neodymium/Neodymium.java
index d47d03a..941a46f 100644
--- a/src/main/java/makamys/neodymium/Neodymium.java
+++ b/src/main/java/makamys/neodymium/Neodymium.java
@@ -39,6 +39,8 @@ public class Neodymium
public static final Logger LOGGER = LogManager.getLogger(MODID);
private static final Config.ReloadInfo CONFIG_RELOAD_INFO = new Config.ReloadInfo();
+
+ private boolean renderDebugText = false;
public static NeoRenderer renderer;
@@ -132,19 +134,15 @@ public class Neodymium
}
@SubscribeEvent
- public void onRenderOverlay(RenderGameOverlayEvent event) {
- FontRenderer fontRenderer = RenderManager.instance.getFontRenderer();
- if(isActive() && event.type == ElementType.TEXT && fontRenderer != null && Minecraft.getMinecraft().gameSettings.showDebugInfo && (Config.debugInfoStartY != -1))
- {
- Minecraft mc = Minecraft.getMinecraft();
- ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
- int w = scaledresolution.getScaledWidth();
- int h = scaledresolution.getScaledHeight();
-
- int yOffset = 0;
- for(String s : renderer.getDebugText()) {
- fontRenderer.drawStringWithShadow(s, w - fontRenderer.getStringWidth(s) - 10, Config.debugInfoStartY + yOffset, 0xFFFFFF);
- yOffset += 10;
+ public void onRenderOverlay(RenderGameOverlayEvent.Pre event) {
+ if (Config.showDebugInfo && isActive()) {
+ if (event.type.equals(RenderGameOverlayEvent.ElementType.DEBUG)) {
+ renderDebugText = true;
+ } else if (renderDebugText && (event instanceof RenderGameOverlayEvent.Text) && event.type.equals(RenderGameOverlayEvent.ElementType.TEXT)) {
+ renderDebugText = false;
+ RenderGameOverlayEvent.Text text = (RenderGameOverlayEvent.Text) event;
+ text.right.add(null);
+ text.right.addAll(renderer.getDebugText());
}
}
}