Skip to content

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

@EnricoMessall

Description

@EnricoMessall

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions