Fix color leak getting into guis (Broken ColorUtils) (#2045)

This commit is contained in:
Ranzu authored and GitHub committed 2026-08-27 14:19:55 -07:00
1 parent b0fd1ea46e
commit 2f64fef6a6
1 file changed
+11 -2
@@ -204,10 +204,19 @@ public class BatchingFontRenderer {
return (argb & 0xFF000000) | (red << 16) | (green << 8) | blue;
}
/**
* True only for a perspective projection (world-space text: signs, nameplates, etc).
* GUI/HUD text uses an orthographic projection and must never be shaded by world lighting -
* mods rely on getting back the exact color they requested (e.g. GTNHLib's ColorResource).
*/
private static boolean isWorldSpaceText() {
return GLStateManager.getProjectionMatrix().m33() == 0.0f;
}
private void captureLightmapState() {
final int unitBinding = GLStateManager.getTextures().getTextureUnitBindings(LIGHTMAP_TEX_UNIT).getBinding();
final boolean active = GLStateManager.getProjectionMatrix().m33() == 0.0f && unitBinding != 0;
final boolean active = isWorldSpaceText() && unitBinding != 0;
float u = 0.0f;
float v = 0.0f;
@@ -1236,7 +1245,7 @@ public class BatchingFontRenderer {
this.beginBatch();
this.captureLightmapState();
this.lightingFactorActive = FFPVertexLighting.modulatesVertexColor(this.lightingFactor);
this.lightingFactorActive = isWorldSpaceText() && FFPVertexLighting.modulatesVertexColor(this.lightingFactor);
float curX = anchorX;
try {
final int totalStringLength = string.length();