Hello, I have a little problem. I new to Minecraft modding and I was trying to make a mod with random things, one of them a overlay with informations. It's all working, but the problem is, that the CHAT section is rendering event if the Chat is not opened, and the same thing for the TEXT section is rendering even in debug, where it's overlapping. I added a statement that it shouldn't render when the ElementType.DEBUG is active but even that isn't working, and all tutorials I founded where for older versions.
CODE:
@SideOnly(Side.CLIENT)
public class onRenderGameOverlay {
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Pre e) {
if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().player != null) {
Minecraft mc = Minecraft.getMinecraft();
FontRenderer fr = mc.fontRendererObj;
if (e.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
// Name
fr.drawStringWithShadow(TextFormatting.BLUE + "" + TextFormatting.BOLD + Reference.FULL_NAME + TextFormatting.DARK_GREEN + " " + TextFormatting.BOLD + "v." + Reference.VERSION, 3, 5, 0xffffff);
// Player Data
fr.drawStringWithShadow(TextFormatting.DARK_GRAY + "[" + TextFormatting.GOLD + "Name" + TextFormatting.DARK_GRAY + "] " + TextFormatting.WHITE + mc.player.getName(), 3, 20, 0xffffff);
fr.drawStringWithShadow(TextFormatting.DARK_GRAY + "[" + TextFormatting.GOLD + "FPS" + TextFormatting.DARK_GRAY + "] " + TextFormatting.WHITE + Minecraft.getDebugFPS(), 3, 40, 0xffffff);
fr.drawString(Main.DATA_DEV + "", 100, 100, 0xffffff);
// DEV DATA
if (Main.DATA_DEV) {
fr.drawStringWithShadow(TextFormatting.DARK_PURPLE + "[" + TextFormatting.LIGHT_PURPLE + "UUID" + TextFormatting.DARK_PURPLE + "] " + TextFormatting.WHITE + mc.player.getUniqueID(), 3, e.getResolution().getScaledHeight()-15, 0xffffff);
}
} else
if (e.getType() == RenderGameOverlayEvent.ElementType.CHAT) {
ScaledResolution res = e.getResolution();
//Color Codes
fr.drawStringWithShadow(TextFormatting.AQUA + "&c - AQUA", res.getScaledWidth()-50, res.getScaledHeight()-50, 0xffffff);
}
}
}
}