Jump to content

Recommended Posts

Posted

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

Posted

Vanilla Gui elements can be removed by canceling the Forge event RenderGameOverlayEvent.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Posted

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) {
                EIHUDHandler.drawHUD(mc);
            } 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

  • 8 months later...
Posted

Hi,

 

I'm having a go at doing a custom HUD too but don't quite understand your code. Could you post the whole class or add some comments please? That would really help.

 

Thanks!

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.

Announcements



×
×
  • Create New...

Important Information

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