Skip to content

[Bug] Entity text components are replaced by an empty string #1

@Rerented

Description

@Rerented

The Problem

In Minecraft 1.21.5 entity text components are replaced with an empty string when an entity's data is merged/modified in any way. This is due to changes to the text component format in Minecraft 1.21.5.

Snippet from Text component format/Before Java Edition 1.21.5 - Minecraft Wiki:

Before Java Edition 1.21.5, the text component format was very different. The biggest difference is that text components were represented exclusively in JSON and saved as strings containing JSON, rather than being represented as SNBT and saved as NBT objects.
For example, instead of {text: "Hello World", color: "red"}, you would write {"text": "Hello World", "color": "red"} or '{"text":"Hello World","color":"red"}' depending on the context.

Example / Steps To Reproduce

  1. Load up Minecraft 1.21.5 with the Client Data Command mod installed, and create a new world with commands enabled.
  2. Summon a Text Display entity with a text component.
    Example: /summon text_display ^ ^2 ^5 {billboard:"vertical",transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[4f,4f,4f]},text:{"bold":true,"color":"gold","text":"Hello World!"}}
  3. Get the client-side data of the Text Display entity. The text component should be present.
    Example: /datac get entity @e[type=minecraft:text_display,limit=1,sort=nearest]
  4. Merge/Modify the client-side data of the Text Display entity in any way.
    Example: /datac merge entity @e[type=minecraft:text_display,limit=1,sort=nearest] {transformation:{scale:[8.0f,8.0f,8.0f]}}
  5. Get the client-side data of the Text Display entity. The text component will have been replaced by an empty string.
    Example: /datac get entity @e[type=minecraft:text_display,limit=1,sort=nearest]
  6. (Bonus) Trying to specifically get the text component will now crash your game:
    Example: /datac get entity @e[type=minecraft:text_display,limit=1,sort=nearest] text

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions