Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - onRenderGameOverlayPost not actually rendering above all Hud Elements #163

Open
EnricoMessall opened this issue Sep 18, 2024 · 0 comments

Comments

@EnricoMessall
Copy link

In the current 1.21.1 version of Malilib the injection of onRenderGameOverlayPost is done like this:

@Mixin(InGameHud.class)
public abstract class MixinInGameHud
{
    @Shadow @Final private MinecraftClient client;

    @Inject(method = "render", at = @At("RETURN"))
    private void onGameOverlayPost(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci)
    {
        ((RenderEventHandler) RenderEventHandler.getInstance()).onRenderGameOverlayPost(context, this.client, tickCounter.getTickDelta(false));
    }
}

but the render function there already has rendered all layers and disabled depth tests again:

public void render(DrawContext context, RenderTickCounter tickCounter) {
        RenderSystem.enableDepthTest();
        this.layeredDrawer.render(context, tickCounter);
        RenderSystem.disableDepthTest();
    }

in the mod AdvancedChatHUD that results in chat boxes being behind the Hud

1.20.1 with MaliLib and AdvancedChatHUD
hud_old

1.21.1 with MaliLib and AdvancedChatHUD
hud_new

to fix that i've created a Mixin in AdvancedChatHUD that changes the onRenderGameOverlayPost to inject into layeredDrawer from Mojang to guarantee its rendered as the last layer

EnricoMessall added a commit to EnricoMessall/malilib that referenced this issue Sep 18, 2024
 + Adjusted RenderEventHandler to be added to layeredDrawer
EnricoMessall added a commit to EnricoMessall/malilib that referenced this issue Sep 18, 2024
 + Adjusted naming to match malilib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant