I don't quite know why the text is not appearing, could it be that I need to call the method in drawForeground instead of drawBackground?
code:
@Override
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
RenderSystem.setShaderTexture(0, TEXTURE);
int x = this.x;
int y = this.y;
context.drawTexture(TEXTURE, x, y, 0, 0, this.backgroundWidth, this.backgroundHeight);
//Ruby dust amount tooltip, pretty cool!
if ((mouseX > x + 25 && mouseX < x + 44) && (mouseY > y +37 && mouseY < y + 44)){
context.drawItem(ModItems.RUBY_DUST.getDefaultStack(), mouseX, mouseY - 16);
context.drawTooltip(this.textRenderer, Text.literal(String.format(" %d/%d", handler.getDustAmount(), 64)), mouseX - 8, mouseY);
}
}
I have tested if the values get through, and they do. It also seems to be very 'situational'.
Sometimes it renders without issue, sometimes it doesn't render at all. If anyone with more experience in Screens could help me out that would be greatly appreciated!
