Posted November 13, 20213 yr Greetings! I wish to create an overlay, similar to the vanilla hotbar, which will display images inside it's slots. The user will be able to scroll trough the hotbar. I would like to know where I may learn about the GUI system, how to use it, and ultimately, how to implement the overlay. Any help would be greatly appreciated.
November 13, 20213 yr Author 4 minutes ago, diesieben07 said: Look at OverlayRegistry to register your own HUD element. See ForgeIngameGui for how the existing ones are implemented. Hello! I believe that class is under a different name (I am unable to find it). I am using forge 1.16.5 with the official mappings.
November 13, 20213 yr Author 2 minutes ago, diesieben07 said: Since you did not specify the Minecraft or Forge version I assumed you are using the most up to date, so 1.17.1. In 1.16.5 use RenderGameOverlay.Post with ElementType.ALL to add stuff to the HUD. @SubscribeEvent public void renderGameOverlay(RenderGameOverlayEvent.Post event) { if(event.getType() != RenderGameOverlayEvent.ElementType.ALL) { return; } LOGGER.info("render!"); } This seems to work. Thank you!
November 14, 20213 yr Author 22 hours ago, diesieben07 said: Since you did not specify the Minecraft or Forge version I assumed you are using the most up to date, so 1.17.1. In 1.16.5 use RenderGameOverlay.Post with ElementType.ALL to add stuff to the HUD. Do you know of any document explaining the parameters and what the methods do? I am very new to graphics programming, and understanding the code with obfuscated names is quite hard. I have been successful in copying and modifying vanilla code, but using it whilst not understanding it is unacceptable for me.
November 14, 20213 yr Author Without an even rudimentary understanding of the code, I cannot figure out why this does not work. textureManager.bind(new ResourceLocation("mod:textures/overlay/bar.png")); // ?? RenderSystem.enableBlend(); // extract image from bound texture (from x 0, y 0 with width 128, height 10) and draw it to screen starting from x 100, y 100 mc.gui.blit(matrix, 100, 100, 0, 0, 128, 10); // ?? RenderSystem.disableBlend();
November 15, 20213 yr Author 7 hours ago, diesieben07 said: Firstly, blit is a static method. Why are you calling it like an instance method? Your IDE should be warning you about this. The version of blit you are using assumes a 256x256 texture. Is your texture that size? I was not. It now works. But that still does not solve the fundamental issue. 23 hours ago, matthew123 said: Do you know of any document explaining the parameters and what the methods do? I am very new to graphics programming, and understanding the code with obfuscated names is quite hard. I have been successful in copying and modifying vanilla code, but using it whilst not understanding it is unacceptable for me. Knowing the cause of the issue and fixing it myself will always be superior to getting help fixing it.
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.