tie text shadows to the custom font being active

HUD text, clickgui buttons, panel titles and the hud editor labels all
go through FrosFont's default draw now, which renders a drop shadow
only while the custom font is loaded. disabling fonts (MinecraftFont
toggle, or a missing font file falling back) renders everything flat,
matching the vanilla look, in both the hud and the clickgui
This commit is contained in:
froslanz
2026-10-22 12:27:52 -04:00
parent 6ab84a1051
commit ebd0a76f0c
4 changed files with 12 additions and 6 deletions
@@ -215,6 +215,6 @@ public class Widget
}
protected void drawString(String text, double x, double y, int color) {
FrosFont.draw(context, text, (int) x, (int) y, color, true);
FrosFont.draw(context, text, (int) x, (int) y, color);
}
}
@@ -80,7 +80,7 @@ public class Item
}
protected void drawString(GuiGraphics context, String text, double x, double y, int color) {
FrosFont.draw(context, text, (int) x, (int) y, color, true);
FrosFont.draw(context, text, (int) x, (int) y, color);
}
public boolean isHovering(int mouseX, int mouseY) {
@@ -120,7 +120,7 @@ public abstract class HudModule extends Module {
textX = x - 5 - textWidth;
}
FrosFont.draw(e.getContext(), getName(),
(int) textX, (int) (y + height / 2f - textHeight / 2f), -1, true);
(int) textX, (int) (y + height / 2f - textHeight / 2f), -1);
HudEditorScreen.getInstance().anyHover = true;
}
@@ -124,7 +124,13 @@ public final class FrosFont {
}
public static void draw(GuiGraphics context, String text, int x, int y, int color) {
draw(context, text, x, y, color, false);
draw(context, text, x, y, color, shadows());
}
/** text shadows only while the custom font is active; the vanilla font renders flat */
public static boolean shadows() {
sync();
return awtFont != null;
}
public static void draw(GuiGraphics context, String text, int x, int y, int color, boolean shadow) {
@@ -142,10 +148,10 @@ public final class FrosFont {
if (component == null) return;
sync();
if (awtFont == null) {
context.drawString(mc.font, component, x, y, color);
context.drawString(mc.font, component, x, y, color, shadows());
return;
}
draw(context, toCodeString(component), x, y, color, false);
draw(context, toCodeString(component), x, y, color);
}
// --- loading ---