Posted July 3, 20178 yr I made my HUD in RenderGameOverlayEvent.Post. All the renders, but when I take a thing in hand, the name of item appears at the bottom of the screen, and at that moment the HUD does not render. How to fix it? Edited July 3, 20178 yr by Minebot1708
July 3, 20178 yr Any code to help us answer? catch(Exception e) { } Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).
July 3, 20178 yr Author 12 minutes ago, Earthcomputer said: Any code to help us answer? In EventHandler: final Minecraft mc = Minecraft.getMinecraft(); final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; final ImplantsHUD implantsHUD = new ImplantsHUD(); @SubscribeEvent public void renderHUD(RenderGameOverlayEvent e){ GlStateManager.pushMatrix(); int x = (e.getResolution().getScaledWidth() - 109) / 7; int y = (e.getResolution().getScaledHeight() - 290) / 2; GlStateManager.translate(x, y, 0); implantsHUD.draw(mc, font, 0); GlStateManager.popMatrix(); } HUD class: public class ImplantsHUD extends Gui{ public void draw(Minecraft mc, FontRenderer font, int voltage){ GlStateManager.pushMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.alphaFunc(GL_GREATER, 0.05f); GlStateManager.color(1,1,1,0.75f); GlStateManager.blendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); mc.getTextureManager().bindTexture(new ResourceLocation("meem:textures/gui/implantshud/energybackground.png")); drawModalRectWithCustomSizedTexture(0, 0, 0,0,109,290,109,290); font.drawString("Energy", 30, -20, 1606345); font.drawString(voltage == 0 ? "Not charging" : voltage + " Volt", 10, 300, voltage == 0 ? 13107200 : 51200); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } } Edited July 3, 20178 yr by Minebot1708
July 3, 20178 yr Author 18 minutes ago, diesieben07 said: You are not actually using RenderGameOverlayEvent.Post, but you should be. You need to check for one element type, otherwise you render once for every HUD element... I just tested, so enderGameOverlayEvent.Post is not worth it. But there is no difference, the problem still does not change. I changed the code. Now the HUD does not appear at all @SubscribeEvent public void renderHUD(RenderGameOverlayEvent.Post e){ if (e.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) { GlStateManager.pushMatrix(); int x = (e.getResolution().getScaledWidth() - 109) / 7; int y = (e.getResolution().getScaledHeight() - 290) / 2; GlStateManager.translate(x, y, 0); implantsHUD.draw(mc, font, 0, 100, 0); GlStateManager.popMatrix(); } }
July 3, 20178 yr Author 18 minutes ago, diesieben07 said: Is the method actually called? Are you sure those coordinates are correct and on-sceen? The method is called. If the coordinates are considered relative to the upper left edge of the window, then they are correct
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.