Fabric API

Fabric API

106M Downloads

Tooltip on title screen suppresses texture draw in AFTER_RENDER event

jackassmc opened this issue ยท 4 comments

commented

This happens in the Screen API test mod in 1.17. It does not happen in 1.16.

The texture gets drawn here:

ScreenEvents.afterRender(screen).register((_screen, matrices, mouseX, mouseY, tickDelta) -> {
// Render an armor icon to test
client.getTextureManager().bindTexture(InGameHud.GUI_ICONS_TEXTURE);
DrawableHelper.drawTexture(matrices, (screen.width / 2) - 124, (screen.height / 4) + 96, 20, 20, 34, 9, 9, 9, 256, 256);
});

The tooltip gets drawn here:

if (this.isMouseOver(mouseX, mouseY)) {
this.screen.renderTooltip(matrices, new LiteralText("Click to stop all sounds"), this.x, this.y);
}

Here's a screenshot of the title screen of the Screen API test mod in 1.17:
Screenshot_2021-06-05_16-50-31

Here's a screenshot of the title screen of the Screen API test mod in 1.17 with the tooltip:
Screenshot_2021-06-05_16-50-44

commented

Is this fixed by #1474?

commented

Is this fixed by #1474?

No, that only fixed buttons not rendering.

commented

Ok weird, if you want to have a look why not, otherwise someone will eventually.

commented

Turns out this is just a test mod issue.

client.getTextureManager().bindTexture(InGameHud.GUI_ICONS_TEXTURE);

is outdated, it's supposed to be:

RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderTexture(0, InGameHud.GUI_ICONS_TEXTURE);

Screen.renderTooltipFromComponents calls

RenderSystem.setShader(GameRenderer::getPositionColorShader);

so in the AFTER_RENDER event the shader is wrong if the tooltip gets rendered but is accidentally right if it isn't.