I tried to write this command but it printed an error: Failed to execute 'setblock' as arrow.

This is the command I'm using:

/execute @e[type=minecraft:arrow] -10 8 18 detect ~ ~ ~ gold_block 0 setblock 0 5 0 gold_block 0
  • 1
    Please don't post images of your commands, post the actual commands. It makes it a lot easier for us to troubleshoot your issue if it's just the text, and the images gain you nothing. – MBraedley Mar 22 '19 at 13:34
  • 1
    What version are you in? This is 1.13 incompatible synax. – SpiceWeasel Mar 23 '19 at 11:53
  • 1
    Oh, I know see the problem. You are trying to execute an arrow if it detects a block at its position, but that is impossible unless the arrow is inside the block, which does not happen if you shoot it at the block. – SpiceWeasel Mar 29 '19 at 1:37

The basic command format is either

/execute [entity or player] x y z detect x y z [type of block]


/execute [entity or player] x y z [command].

You cannot use detect and setblock together, in your case.

An alternative can be:

/execute @e[type=minecraft:arrow] -10 8 18 detect ~ ~ ~ gold_block 0 (repeating command block)

then in another cmd block (conditional chain command block),

/execute @e[type=minecraft:arrow] ~ ~ ~ setblock 0 5 0 gold_block 0.

This only works if there is only one existing arrow at a time.

| improve this answer | |
  • "detect" is an addendum to the syntax for /execute and does work with another command. – pppery Aug 26 '19 at 23:57
  • well now you can... i don't think you could have earlier when this post ewas created – villager1 Sep 2 '19 at 22:37

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.