/execute on attacker will not work if the entity has been previously targeted by the /data command that tick. This problem does not exist in version 1.21.4.
To reproduce:
/tick freeze/summon iron_golemPunch the iron golem
/execute as @n[type=minecraft:iron_golem] on attacker run say yes✔ You say "yes"
/data get entity @n[type=minecraft:iron_golem]/execute as @n[type=minecraft:iron_golem] on attacker run say yes❌ Nothing is output
The above situation can also lead to errors in datapacks and command blocks.
Linked issues
relates to 1
Attachments
Comments 2
can confirm, also happens with targets selected by a target selector with the nbt= parameter. Also affects 25w04a. Relates to MC-279543, a similar (but not duplicate) bug that I reported myself.
Can confirm.