fix invisible text for colors without an alpha channel

FrosFont.flush passed colors to AWT as RGBA, so vanilla-style rgb
constants like 0x55FF55 got alpha 0 and drew fully transparent - this
made the Armor HUD's durability percentages (green/yellow/red) never
show. Alpha-less colors now draw opaque, matching vanilla's own
treatment of ChatFormatting-style colors.
This commit is contained in:
froslanz
2026-10-24 13:52:35 -04:00
parent 2f5c54e675
commit a5622036f0
@@ -414,7 +414,11 @@ public final class FrosFont {
private static int flush(Graphics2D graphics, String text, int start, int end, int cursor, int color, int baseline) {
if (end <= start) return cursor;
String segment = text.substring(start, end);
graphics.setColor(new Color(color, true));
// rgb colors without an alpha channel (0x55FF55, like vanilla's own
// formatting codes) draw opaque, matching vanilla's rule of treating
// a missing alpha as 255 instead of rendering invisible text
int argb = (color & 0xFF000000) == 0 ? 0xFF000000 | color : color;
graphics.setColor(new Color(argb, true));
graphics.drawString(segment, cursor, baseline);
return cursor + metrics.stringWidth(segment);
}