Mojira Archive
MC-124008

scores in JSON for CustomName don't display

The bug

CustomName values have been changed to support JSON text. Part of JSON text is the ability to display scores, via syntax such as `{"score":{"name":"@s", "objective":"SomeObjective"}}` . But if you use this in a CustomName for an entity, it doesn't work. It also doesn't error; it just displays as an empty string.

Reproduction steps

  1. Create a dummy scoreboard objective called HP (for this example):
    /scoreboard objectives add HP dummy
  2. Summon a cow with that HP objective in its JSON name:
    /summon minecraft:cow ~ ~ ~ {CustomName:"{\"score\":{\"name\":\"@s\",\"objective\":\"HP\"}}", CustomNameVisible:1b}
  3. Set the cow's HP score via something like
    /scoreboard players set @e[type=cow,limit=1,sort=nearest] HP 10

Watch as the name remains empty instead of showing 10. Changing the selector in the JSON from @s to @e[type=cow,limit=1,sort=nearest] doesn't fix it, either.

Workarounds

Use other means to resolve the text component and then use the /data command to copy the text component.

Duplicate

Daniel Burnett

2018-01-07, 09:16 AM

2021-01-16, 02:51 AM

2021-01-16, 02:51 AM

1

8

Community Consensus

Minecraft 18w01a

-