MaLiLib (Forge)

MaLiLib (Forge)

291k Downloads

Bug - onRenderGameOverlayPost not actually rendering above all Hud Elements

EnricoMessall opened this issue ยท 0 comments

commented

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