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

scores in JSON for CustomName don't display

XMLWordPrintable

    • Icon: Bug 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

      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.

            Unassigned Unassigned
            IceMetalPunk Daniel Burnett
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: