2

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?

2
  • I don't think you need the inData tag, and I have a feeling you'll need the tag tag, but I haven't looked at the NBT data structure for arrows in order to tell you exactly what's wrong with the command.
    – MBraedley
    Commented Oct 3, 2019 at 18:09
  • Would a detector facing the wool block be able to pick up the update? This could power your command block, making the command a bit simpler?
    – Ben
    Commented Oct 4, 2019 at 2:19

1 Answer 1

4

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
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .