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 at 13:34
  • 1
    What version are you in? This is 1.13 incompatible synax. – SpiceWeasel Mar 23 at 11:53
  • 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 at 1:37

Try doing type=arrow instead of type=minecraft:arrow. I don't believe it is necessary to have the minecraft:.


/execute @e[type=arrow] -10 8 18 detect ~ ~ ~ gold_block 0 setblock 0 5 0 gold_block 0

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 ^ ^ ^0.5 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.

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.