fix(font): 修复 betterFont下自定义计分板文字透明不可见 - #175
Merged
gaoyu06 merged 2 commits intoAug 2, 2026
Merged
Conversation
UFontRenderer.drawString 未按 vanilla 规则把无 alpha 位的颜色强制为不透明, ScoreboardComponent 以 0xFFFFFF 传色,经自定义字体路径渲染后 alpha=0 全透明, 导致开启"更好的字体"后自定义计分板整块消失(背景默认透明)。 按 FontRenderer 的规则在 edge$drawStringInternal 中补齐。
Contributor
Author
|
fix #174 |
…de solid Forcing a colour with no alpha bits to opaque is right for UFontRenderer - it extends FontRenderer and is handed around as one, LevelTag picks between it and fontRendererObj at runtime, so a vanilla-shaped colour has to mean there what it means everywhere else. But it costs the alpha 1-3 band, and the client was running fades straight through it. The OOBE greeting crossfade is the one that shows. previousAlpha is cubic, so it sits at or below three for the last thirty-odd frames of the half-second fade, and the greeting rotates every 2.2s: the outgoing text would have held full opacity for half a second and then vanished. The tutorial slide is smaller - updateTutorialAutoplay resets the transition after updateAnimations has advanced it, so the frame a slide flips renders at exactly zero and would pop in solid. Both stop at four now, which is what MixinGuiNewChat already does and what every other fade in the client already did by guarding above the band. Component colours come from ColorSetting, whose alpha slider reaches zero and whose Wave mode scales what it returns, so Component.drawString takes alpha at its word and draws nothing below four. That is the opposite dialect to the renderer's, which is fine - they are different layers - and it leaves shapes alone: backgrounds go through drawRect and never come past here, so a fully transparent background stays transparent. The custom scoreboard was the one component writing vanilla's spelling of opaque white; it passes -1 now, like the other twelve. Co-Authored-By: Claude <noreply@anthropic.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因:UFontRenderer.drawString 没有像 vanilla FontRenderer 那样把「无 alpha 位的颜色」强制为不透明(vanilla
规则:if ((color & 0xFC000000) == 0) color |= 0xFF000000)。自定义计分板以 0xFFFFFF
传色(ScoreboardComponent.java:69,73),经 betterFont 路径 Alpha.apply 后 alpha 仍为 0,TextRenderer
把所有四边形的 alpha 写成 0 → 文字全透明。而计分板背景默认是透明黑,所以整块「消失」。其他 HUD 都传 -1
或带显式 alpha,所以只有计分板中招。