Posted October 12, 20205 yr Hello everybody, i need your help. I render a custom screen in Minecraft with the RenderGameOverlayEvent, but the Armor Bar and Food Bar lose their texture coordinates. Is that a bug or am I doing something wrong? Event-Handler: @Mod.EventBusSubscriber public class GuiEvents { @SubscribeEvent public static void renderGUI(RenderGameOverlayEvent.Post event) { new PlayerDataScreen(Minecraft.getInstance(), event.getMatrixStack()); } } Screen: public class PlayerDataScreen extends IngameGui { public PlayerDataScreen(Minecraft mcIn, MatrixStack matrixStack) { super(mcIn); StringTextComponent textComponent = new StringTextComponent(""); textComponent.func_240699_a_(TextFormatting.GOLD); textComponent.func_230529_a_(new StringTextComponent(",").func_240699_a_(TextFormatting.WHITE)); textComponent.func_230529_a_(new StringTextComponent("").func_240699_a_(TextFormatting.DARK_GRAY)); textComponent.func_230529_a_(new StringTextComponent(",").func_240699_a_(TextFormatting.WHITE)); textComponent.func_230529_a_(new StringTextComponent("").func_240699_a_(TextFormatting.DARK_RED)); this.getFontRenderer().func_243246_a(matrixStack, textComponent, 15,15, 16); } } Result: Edited October 13, 20205 yr by DestroyedAdventure
October 12, 20205 yr Author 17 minutes ago, diesieben07 said: You must check the element type when subscribing to RenderGameOverlayEvent (RenderGameOverlayEvent#getType), otherwise your code will run many times every frame - for every part of the HUD that is being drawn. For simply adding to the HUD, use ElementType.ALL. Why on earth are you extending IngameGui? This makes no sense. I changed this in the Event-Handler and the PlayerDataScreen extending now from the AbstractGui Class (Is this the right class? Or should I choose the ForgeIngame class?). But it works perfectly 49 minutes ago, diesieben07 said: Why are you drawing stuff inside a constructor? This makes no sense. I cant find any methode to override for drawing content Im stupid and it's really hard with obfuscated names 21 minutes ago, diesieben07 said: The last two points I think I have seen before. Are you following a tutorial? Nope, i'm studying alone i have a question @diesieben07, can you speak german?^^
October 12, 20205 yr Author 1 hour ago, diesieben07 said: Make your own? Please learn basic Java. Yes. War der Meinung, dass es in einer älteren Version von Forge/Minecraft eine Methode zum rendern von Elementen gab, die überschrieben wurde. Hätte ja sein können, dass es die noch gibt oder ich verwechsle da was🤔. Das letzte mal habe ich mich mit Minecraft Forge Modding 2013 beschäftigt . Hab jetzt eine eigene Methode geschrieben, die aufgerufen wird. Danke für die Hilfe! Funktioniert!
October 13, 20205 yr Author 3 hours ago, diesieben07 said: Please keep this forum in English. Sorry, but my text is irrelevant to others. It contains neither solutions or problems and was addressed to you. I thought it wouldn't be a problem if it was written in German.
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.