0

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?

  • 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 Oct 3 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 Oct 4 at 2:19
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.