Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

  • 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.

  • 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!

  • 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.

  • 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();

goPyiaf.png

ICeWEVc.png

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.