mojira.dev
MC-259820

Text display entity always resolves text components at position 0 0 0 when summoned

When a text display entity is summoned, it ignores both the execution context of the command and its own position when resolving the text components on it. Instead they are always resolved with a default position of 0 0 0.
For comparison, sign blocks use their own position when resolving text components.

How to reproduce

1. Prepare the world by creating things to detect at 0 0 0

/forceload add 0 0
/summon marker 0 0 0 {CustomName:'"Fail 1"'}
/setblock 0 0 0 command_block{CustomName:'"Fail 2"'}

2. Summon the text display

/summon text_display ~ ~ ~ {text:'[{"selector":"@e[sort=nearest,limit=1]"},", ",{"nbt":"CustomName","block":"~ ~ ~","interpret":true}]'}

3. Compare what is displayed on the new entity with the output of the equivalent tellraw command. Expected is that they would match

/tellraw @p [{"selector":"@e[sort=nearest,limit=1]"},", ",{"nbt":"CustomName","block":"~ ~ ~","interpret":true}]

Comments 3

it seems that i know why it happens. the root of the problem is that you did not write Pos in summon`s NBT.

i tried this:

/summon text_display ~ ~ ~ {text:'[{"selector":"@e[sort=nearest,limit=1]"},", ",{"nbt":"CustomName","block":"~ ~ ~","interpret":true}]',Pos:[10d,10d,10d]}

and it finds me. (i was standing near 10 10 10) 

The thing is, the x y z arguments are the position; having to write Pos to have it resolve correctly is incredebly wrong.

Can confirm in 1.19.4

AmberW

(Unassigned)

Confirmed

Platform

Normal

Commands

23w06a, 1.19.4 Pre-release 1

Retrieved