Skip to content

Fixed the armor hud durability numbers drawing under the armor icons - #6849

Open
dekrom wants to merge 1 commit into
MeteorDevelopment:masterfrom
dekrom:fix/armor-hud-durability-text
Open

dekrom wants to merge 1 commit into
MeteorDevelopment:masterfrom
dekrom:fix/armor-hud-durability-text

Conversation

@dekrom

@dekrom dekrom commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Type of change

  • Bug fix
  • New feature

Description

Follow-up to #6662. With durability on Total or Percentage the numbers are drawn now, but with
the custom font on (the default) they end up underneath the armor icons, so you only see the
parts that stick out past the item.

The text is drawn from the post task with TextRenderer.get(). With the custom font that is
CustomTextRenderer, and its end() draws the mesh straight away, inside the 2D event. The
items from renderer.item() only go into the gui render state and are drawn after the event by
guiRenderer.render() in GuiRendererMixin, so anything the custom font draws over a hud item
gets covered by it.

VanillaTextRenderer goes through graphics.text(), which is queued together with the items and
drawn above them, the same way the vanilla stack count is. Using it for the durability text puts
the numbers on top. The trade-off is that these numbers always use the vanilla font, and since
VanillaTextRenderer always draws a shadow, durability-shadow only does something with the
custom font off. Keeping the custom font here would need a way to draw it after the gui render
pass, which felt like too much for this.

Related issues

#6576, #6662

How Has This Been Tested?

Singleplayer on 26.3, creative, wearing a damaged diamond helmet, elytra, netherite leggings and
gold boots with durability on Percentage. Before, the numbers were mostly hidden behind the icons.
After, they read 45 / 31 / 91 / 100 on top of them. Also tried Total with Vertical orientation and
the hud custom font off, no begin/end errors. Ran it both from the dev environment and as a jar
in a normal install.

Checklist:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant