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.

[1.19 - 1.20] User defined HUD element is being drawn over the top of vanilla elements

Featured Replies

Posted

I have a custom IGuiOverly defined to show the players hydration levels. Preferably, I would like it to appear between the hunger level tracker and the air bubble tracker. Currently I have manually positioned it above hunger with the RenderSystem and the GuiGraphics.blit method and it is just being drawn on top of the air tracker if a player submerges themselves.

    public static final IGuiOverlay HUD_THIRST = ((gui, guiGraphics, partialTick, screenWidth, screenHeight) -> {
        int x = screenWidth / 2;
        int y = screenHeight;

        RenderSystem.setShader(GameRenderer::getPositionTexShader);
        RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
        RenderSystem.setShaderTexture(0, EMPTY_THIRST);

        for(int i = 0; i < 10; i++) {
            guiGraphics.blit(EMPTY_THIRST, x + 8 + (i * 8), y -51, 0, 0, 13, 12,
                    13, 12);
        }

        RenderSystem.setShaderTexture(0, FILLED_THIRST);

        for(int i = 0; i < 10; i++) {
            if(ClientThirstData.get() > i) {
                guiGraphics.blit(FILLED_THIRST, x + 8 + (i * 8), y -51, 0, 0, 13, 12,
                        13, 12);
            } else {
                break;
            }
        }
    });

Is there a way to bump the air bubble tracker up a few few pixels or make my GUI overlay known to the vanilla classes to prevent overlapping?

I'm the CEO of breaking things 

  • Author

Notes for self and anyone else it might help:

the main forge event bus has several screen-related events, the vanilla Minecraft code also has an event for 'RenderGuiOverlayEvent' (Pre and Post), may be able to insert status bar as the vanilla gui is rendered and potentially manipulate gui elements from there.

Edited by Capricocious
typo

I'm the CEO of breaking things 

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.