mojira.dev
MC-126479

Tellraw command only applies team color if using selector to target more than one entity

When using the /say command to say the name of an entity, e.g.
"/say @a"
It is always the case, that the name(s) said are in the colour of the team they are assigned to.

When using the "/tellraw" command however, e.g.
"/tellraw @s [{"selector":"@a"}]"
The team colors are only applied if the selector returns more than one entity. This is problematic when using team colors as a way to format parts of a longer /tellraw command.

Follow these steps to reproduce:
1 Create a new world in the 1.13 snapshot
2 Run this command: "/summon armor_stand ~ ~ ~ {Tags:["Tag1","Tag3"]}"
3 Run this command: "/summon armor_stand ~ ~ ~ {Tags:["Tag2","Tag3"]}"

4 Run this command: "/team add Test1"
5 Run this command: "/team add Test2"

6 Run this command: "/team option Test1 color red"
7 Run this command: "/team option Test2 color blue"

8 Run this command: "/team join Test1 @e[tag=Tag1]"
9 Run this command: "/team join Test2 @e[tag=Tag2]"

10 Run the commands "/say @e[tag=Tag1]" and "/say @e[tag=Tag2]". You will note, that the
     team color is properly displayed on the names.
11 Run the commands "/tellraw @s [{"selector":"@e[tag=Tag1]"}]" and "/tellraw @s 
     [{"selector":"@e[tag=Tag2]"}]". You will note, that the team color is not displayed on the 
     names. The team color will however display if the selector returns more than one entity. 
     This can be observed by running the command: "/tellraw @s [{"selector":"@e[tag=Tag3]"}]". 
     /say also works this way, which is as expected: "/say @e[tag=Tag3]"

The results of the commands can be seen on the attached images.

Doesn't only affect team color, all components except plain text seems to be affected. See comments for more info.

Linked issues

Attachments

Comments 7

Please do not mark unreleased versions as affected.
You don't have access to them yet.

This bug is still present in Minecraft 18w09a

This bug is still present in Minecraft 18w10a.

You don't need to comment if you can add the affected version yourself.

Doesn't only affect team color, all components except plain text seems to be affected:

summon minecraft:area_effect_cloud ~ ~ ~ {CustomName: "{\"bold\": true, \"color\": \"blue\", \"text\": \"hi\"}", Tags: ["temp"]}
tellraw @s ["", {"selector":"@e[tag=temp]"}]
say @e[tag=temp]

-> the tellraw command show plain white text

-> the say command has the right formatting

Seems related to MC-123813

summon minecraft:area_effect_cloud ~ ~ ~ {CustomName: "{\"translate\": \"%s\", \"with\": [{\"bold\": true, \"color\": \"blue\", \"text\": \"hi\"}]}", Tags: ["temp"]}
tellraw @s ["", {"selector":"@e[tag=temp]"}]

eventhough it only finds 1 entity, the formatting works when it's translating text and inserting elements from the "with" list

This isn't an issue anymore in 1.13-pre4

Anton Bertelsen

(Unassigned)

Confirmed

Minecraft 1.12.2, Minecraft 18w08b, Minecraft 18w09a, Minecraft 18w10a, Minecraft 18w11a

Minecraft 1.13-pre4

Retrieved