-
Bug
-
Resolution: Duplicate
-
None
-
Minecraft 18w01a
-
None
-
Community Consensus
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
- Create a dummy scoreboard objective called HP (for this example):
/scoreboard objectives add HP dummy
- Summon a cow with that HP objective in its JSON name:
/summon minecraft:cow ~ ~ ~ {CustomName:"{\"score\":{\"name\":\"@s\",\"objective\":\"HP\"}}", CustomNameVisible:1b}
- 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.
- duplicates
-
MC-131328 The "score" and "selector" text component isn't being applied properly in all cases
- Resolved