Jump to content

[1.11.2] Maybe bugged onRenderOverlayEvent


Tim3Game

Recommended Posts

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);

            }
        }
    }
}

 

Link to comment
Share on other sites

Interesting grammar choice, but scroll through the gui folder in the Minecraft source code, all the GUIs are there, just take in to consideration of how they might be named, then look into their functionality (I find the buttons the most helpful) and decide if that truly is the GUI you are looking for. If I have this correct, the GuiOverlayDebug and GuiIngameMenu are the specific classes you are looking for.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.