Fixed nametag text rendering off-screen with the custom font disabled - #6658
Merged
Wide-Cat merged 1 commit intoSep 13, 2026
Conversation
NametagUtils.begin(Vector3d) only pushes onto the RenderSystem model-view stack, which is what CustomTextRenderer draws through. VanillaTextRenderer draws through graphics.pose() instead, so every call site using the graphics-less overload left that stack untransformed and the text was drawn at its raw local offsets near the screen origin instead of at the entity. Switch the remaining call sites to the begin(Vector3d, GuiGraphicsExtractor) and end(GuiGraphicsExtractor) overloads, the same way the player nametag and WaypointsModule already do. Every one of them already had the graphics instance in scope.
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.
Type of change
Description
With Custom Font disabled, nametag text is drawn at the top-left of the screen (usually clipped off it entirely) instead of above the entity.
NametagUtilshas two pairs of overloads:The graphics-less pair only pushes onto
RenderSystem.getModelViewStack(). That is whatCustomTextRendererdraws through (MeshBuilder/ theUI_TEXTpipeline), so with the custom font everything lines up.VanillaTextRenderer.render()does not touch that stack at all — it draws throughgraphics.pose():So at every call site using
begin(pos),graphics.pose()was never translated to the entity's screen position and the text landed at its raw local offsets — which are negative (-widthHalf,-heightDown), hence off the top-left corner.This is the same fix already applied to
WaypointsModulein #6577 and to the player nametag path inNametags#renderNametagPlayer; these call sites were just missed. All of them already had theGuiGraphicsExtractorin scope, so the change is passing it through:NametagsEntityOwnerLogoutSpotsCrystalAuraNotebotHighwayBuilderP/Nmining-mode letterPlayer nametags were already correct, which is why the bug looks like "only some nametags are broken".
No behaviour changes with Custom Font enabled:
begin(pos, graphics)callsbegin(pos)internally, so the model-view path is untouched. The graphics-less overloads are kept (they are still used internally and are public API for addons).Related issues
Closes #6593
How Has This Been Tested?
./gradlew compileJavapasses.I isolated the two transform paths and reproduced the offset numerically. Taking an entity projected by
to2Dto GUI-space(700, 300)and a mob nametag whose local offset is(-widthHalf, -heightDown) = (-25, -9):Before the fix the text sits at negative coordinates — off the top-left of the screen, matching the screenshot in #6593. After it, the vanilla path lands on exactly the same pixel as the custom-font path.
In-game, with Custom Font off: item/mob/TNT nametags, EntityOwner, LogoutSpots, CrystalAura damage text, Notebot and HighwayBuilder's letter all now track their entity/block instead of piling up in the corner.
Checklist: