Posted November 18, 201311 yr 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
November 18, 201311 yr 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.
November 19, 201311 yr Author 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
July 23, 201411 yr 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.