How to detect if an arrow hit a red wool block in 1.14?

I need to test if an arrow hit a red wool block in a Minecraft 1.14. I'm using the following command:

execute if entity @e[type=item,nbt={Item:{id:"minecraft:arrow"},inTile:{minecraft:red_wool},inData:0b}] run say hi

However, it does not work for me. What can I change to get this command to work correctly?


Solution 1:

This command isn't working because you are conflating item entities and arrow entities. The selector @e[type=item,nbt={Item:{id:"minecraft:arrow"}}] matches item entities containing arrows (when you drag an arrow out of your inventory and put it on the ground), not arrow entites (what happens when you shoot an arrow). Item entities don't have a inTile tag, so the command can never match anything.


Additionally, inTile is for an old version of Minecraft, and the correct NBT tag is inBlockState.


The following command (untested) should properly detect arrows in red wool.

execute if entity @e[type=arrow,nbt={inBlockState:{Name:"minecraft:red_wool"}}] run say hi