How can I select an entity by it's NBT tag?
I don't know why this command failed to find the creeper.
# Summoned via
/summon minecraft:creeper 208.46 79.00 -74.56 {Fuse: 9999,Health: 1,ignited: 1}
# Testing selector
/execute if entity @e[type=minecraft:creeper,nbt={ignited:1}] run tellraw "true"
# Also tried
/execute if entity @e[type=minecraft:creeper,nbt={ignited: 1}] run tellraw "true"
/execute if entity @e[type=minecraft:creeper,nbt={ignited:1b}] run tellraw "true"
/execute if entity @e[type=minecraft:creeper,nbt={ignited: 1b}] run tellraw "true"
The syntax for /tellraw
is
/tellraw <targets> <message>
You didn´t specify a target, so the command fails to execute. You can just add @a and it will work.
/execute if entity @e[type=minecraft:creeper,nbt={ignited:1b}] run tellraw @a "true"