mojira.dev
MC-263109

Text displays do not update their size when reloading resources

Text display entities do not update their size when the resource pack is reloaded and the fonts are modified, causing the background to have an incorrect size and the text not to be centered around the display entity location.

This impacts servers which use custom fonts on text displays because players load the resource pack after joining.

Steps to reproduce

  • Spawn a text display which uses a custom font (without the resource pack being enabled):

    /summon minecraft:text_display ~ ~ ~ {text: {"text": "Hello", "extra": [{"text": "-", "font": "testfont:space"}, {"text": "World"}]}}
  • Enable the attached resource pack (

[media]
  • ).

  • Observe that the text exceeds the width of the background and is not centered around the entity location correctly.

  • Leave and rejoin the world.

  • The text is now displayed correctly.

The attached resource pack contains the font testfont:space which makes the - character a wide space.

Analysis

The text width is cached in clientDisplayCache (Mojang mappings) in the Display.TextDisplay class. This cache is not invalidated when the resource pack is reloaded.

Attachments

Comments 3

This issue can be work-arounded by

  1. resending a metadata update for the entities, once the resource pack is loaded or

  2. sending the resource pack during the configuration phase (1.20.2+)

56738

(Unassigned)

Community Consensus

Platform

Normal

Resource Packs, Text, UI

1.19.4, 1.20 Release Candidate 1, 1.20, 1.20.1 Release Candidate 1, 1.20.1, ..., 24w07a, 24w13a, 24w19b, 1.21.5, 1.21.6 Release Candidate 1

Retrieved