mojira.dev
MC-152197

@s selector doesn't work in /data commands

You need a sign and an entity to test this commands.

Replace <pos of sign> with the coords of your sign.

 

/execute as @e[type=!minecraft:player,limit=1,sort=nearest] run data merge block <pos of sign> {Text1:'{"extra":[{"text":"Name: "},{"selector":"@s"}],"text":""}'}

 

/execute as @e[type=!minecraft:player,limit=1,sort=nearest] run data modify block <pos of sign> Text1 set value '{"extra":[{"text":"Health: "},{"nbt":"Health","entity":"@s"}],"text":""}'

 

Comments 1

This is based on a bit of a false conception. The @s inside the text is not evaluated right away, it's handled by the sign itself. This can be shown bserved by putting something like @a[sort=nearest] into the sign and observing that it sorts by distance to the sign, not the command block. Likewise, @s is meaningless from the sign's perspective. So all in all, not a bug

FACS01

(Unassigned)

Unconfirmed

Commands

Minecraft 1.14.2 Pre-Release 2

Retrieved