Jump to content

Vanilla Hud replacement via toggle.


Recommended Posts

Hello fellow Modders!


As the topic suggests, I'm trying to get my head around replacing the vanilla HUD, including any additions that other mods make.


The reason is my mod will enough HUD elements that using the Vanilla HUD would get extremely messy. With mod's such as NEI/Thaumcraft/VoxelMap using much of the HUD space, I require temporarily removing these as well as the vanilla bar down the bottom temporarily, replacing it with my HUD elements.


Being able to toggle between the two allows me to maintain compatibility with forge mods as well as having a tidy HUD to deal with.


GUI/HUD is one part of the minecraft code that I haven't really looked into yet and I really appreciate any help you can give me.

The difference between stupidity and genius is that genius has its limits. - Albert Einstein

Link to comment
Share on other sites

Thanks, I'll try it.


EDIT: Works like a charm! thankyou very much.


EDIT2: Theres only one issue. when preventing the HUD to draw, it also prevents any GUI elements to be drawn. This means the menu screen, and any GUI's that open wont draw. Is there a way to remove the Vanilla HUD, but keep the Vanilla currentScreen?


EDIT3: Fixed it myself. Pretty much, while the custom hud is being drawn if a Vanilla GUI item is opened(inventory/menu etc.). It will cancel the vanilla HUD override and set a boolean to say that a vanilla GUI is open. The the next time currentScreen becomes null; it automatically switches back tot he custom HUD.


public void tickEnd(EnumSet<TickType> type, Object... tickData) {
        if (type.equals(EnumSet.of(TickType.RENDER))) {
            Minecraft mc = FMLClientHandler.instance().getClient();
            EntityPlayer player = mc.thePlayer;
            if (mc.currentScreen == null && EIHUDHandler.vanillaGUIOpen) {
                EIHUDHandler.vanillaGUIOpen = false;
                EIHUDHandler.overrideVanillaHUD = true;

            if (mc.currentScreen == null && EIHUDHandler.overrideVanillaHUD && player != null) {
            } else if (mc.currentScreen != null && EIHUDHandler.overrideVanillaHUD && player != null) {
                EIHUDHandler.overrideVanillaHUD = false;
                EIDebugHandler.tempDebugToConsole("resetting hud override");
                EIHUDHandler.vanillaGUIOpen = true;

The difference between stupidity and genius is that genius has its limits. - Albert Einstein

Link to comment
Share on other sites

  • 8 months later...

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.

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.