mojira.dev
MC-233562

Signs are re-executing setblock commands as themselves at themselves.

Just as command blocks can execute commands with predefined selected targets, so too should signs be able to.

Example: perform this command either as datapack, command_block, or chat-interface:

execute at @p run setblock 0 64 0 minecraft:oak_sign{Text1:'{"selector":"@s"}'} replace

and the sign is re-executing the setblock command as itself at itself, the command is not finishing via the intended selected entity player, thus selector:@s means nothing to the sign because it's a block and not an entity, and it generates a blank sign.

Within datapacks and command_blocks, a setblock may be required to create a sign in a position that is intended to be executed by a player who is not necessarily the closest player to the sign thus being created, which is why

Text1:'{"selector":"@p"}'

may not always be appropriate. Just as command blocks can execute commands with defined selected targets, so too should setblock for a sign be able to.

Comments 2

This works as intended. To work around it, do something like

tag @s add self
setblock ~ ~ ~ sign{Text1:'{"selector":"@a[tag=self]"}'}
tag @s remove self

Thank you for the workaround feedback... which is helpful.

Gatinh0

(Unassigned)

Unconfirmed

(Unassigned)

1.17.1

Retrieved