Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-263109

Text displays do not update their size when reloading resources

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.4, 1.20 Release Candidate 1, 1.20, 1.20.1 Release Candidate 1, 1.20.1, 1.20.2 Pre-Release 4, 1.20.2 Release Candidate 1, 1.20.2, 23w44a, 1.20.3 Pre-Release 1, 1.20.3 Pre-Release 2, 1.20.4, 24w07a, 24w13a, 24w19b
    • None
    • Community Consensus
    • Resource Packs, Text, UI
    • Normal
    • Platform

      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 (testfont.zip).
      • 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.

        1. 01-without-pack.png
          01-without-pack.png
          11 kB
        2. 02-after-enabling-pack.png
          02-after-enabling-pack.png
          18 kB
        3. 03-with-pack.png
          03-with-pack.png
          15 kB
        4. testfont.zip
          0.6 kB

            Unassigned Unassigned
            56738 56738
            Votes:
            14 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              CHK: