refinedmods / refinedstorage2

Refined Storage is a mass storage mod for Minecraft that offers the player a network-based storage system, allowing them to store items and fluids on a massively expandable device network.

Home Page:https://refinedmods.com/refined-storage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The drawing order of tooltips is incorrect

BloCamLimb opened this issue · comments

Describe the bug

Tooltips have transparency and its Z value is 400, if the tooltip is drawn first, then all the elements that are drawn later will be discarded by depth test. So you cannot draw tooltips immediately before all elements with Z<400 are drawn.

public void renderWidget(final GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTicks) {
graphics.blit(getTextureIdentifier(), getX(), getY(), 238, isHovered ? 35 : 16, WIDTH, HEIGHT);
graphics.blit(
getTextureIdentifier(),
getX() + 1,
getY() + 1,
getXTexture(),
getYTexture(),
WIDTH - 2,
HEIGHT - 2
);
if (isHovered) {
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.5f);
graphics.blit(getTextureIdentifier(), getX(), getY(), 238, 54, WIDTH, HEIGHT);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
Platform.INSTANCE.renderTooltip(graphics, buildTooltip(), mouseX, mouseY);
}
if (warning != null) {
renderWarning(graphics);
}
}

Screen#setTooltipForNextRenderPass is the right way to go. Please refer to this issue for a detailed explanation BloCamLimb/ModernUI#216

How can we reproduce this bug or crash?

The issue is just there, Platform.INSTANCE.renderTooltip(graphics, buildTooltip(), mouseX, mouseY); should not be called at that time.

public void renderWidget(final GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTicks) {
graphics.blit(getTextureIdentifier(), getX(), getY(), 238, isHovered ? 35 : 16, WIDTH, HEIGHT);
graphics.blit(
getTextureIdentifier(),
getX() + 1,
getY() + 1,
getXTexture(),
getYTexture(),
WIDTH - 2,
HEIGHT - 2
);
if (isHovered) {
RenderSystem.enableBlend();
RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.5f);
graphics.blit(getTextureIdentifier(), getX(), getY(), 238, 54, WIDTH, HEIGHT);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
Platform.INSTANCE.renderTooltip(graphics, buildTooltip(), mouseX, mouseY);
}
if (warning != null) {
renderWarning(graphics);
}
}

What Minecraft version is this happening on?

Minecraft 1.20.4

What NeoForge or Fabric version is this happening on?

The latest version at this moment

What Refined Storage version is this happening on?

The latest version at this moment

Relevant log output

No response

Thanks for reporting back, this will be fixed for mc 1.20.4.