diff options
Diffstat (limited to 'src/main/java/makamys/lodmod')
-rw-r--r-- | src/main/java/makamys/lodmod/LODMod.java | 20 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRenderer.java | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java index 66642c0..6b0e2c7 100644 --- a/src/main/java/makamys/lodmod/LODMod.java +++ b/src/main/java/makamys/lodmod/LODMod.java @@ -1,5 +1,11 @@ package makamys.lodmod; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.WorldEvent; @@ -62,4 +68,18 @@ public class LODMod renderer.serverTick(); } } + + @SubscribeEvent + public void onRenderOverlay(RenderGameOverlayEvent event) { + FontRenderer fontRenderer = RenderManager.instance.getFontRenderer(); + if(isActive() && event.type == ElementType.TEXT && fontRenderer != null && Minecraft.getMinecraft().gameSettings.showDebugInfo) + { + Minecraft mc = Minecraft.getMinecraft(); + ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + int w = scaledresolution.getScaledWidth(); + int h = scaledresolution.getScaledHeight(); + String s = renderer.getDebugText(); + fontRenderer.drawStringWithShadow(s, w - fontRenderer.getStringWidth(s) - 10, 80, 0xFFFFFF); + } + } } diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index b8121ed..2295848 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -492,6 +492,10 @@ public class LODRenderer { return null; } + public String getDebugText() { + return "VRAM: " + (nextMeshOffset / 1024 / 1024) + "MB / " + (BUFFER_SIZE / 1024 / 1024) + "MB"; + } + public static class LODChunkComparator implements Comparator<LODChunk> { Entity player; |