2

I am trying to make a puzzle map and I want a redstone block to be placed when a certain block is broken. I am putting this command into a Repeating, Always Active command block:

execute @p ~ ~ ~ detect -712 58 -1887 minecraft:air 0 setblock -729 56 -1884 minecraft:redstone_block

The command will always spit out "Could not execute "detect" as Creeel"

  • So a few things. First, you probably don't need to be using execute, as it looks to be overkill for what you want. Instead, I would suggest using testforblock, and use a conditional chain command block to perform the setblock. Second, you might be getting the error if the block you're targeting isn't loaded. While testing, were you in the area of the place you're trying to check? – MBraedley Jul 23 '17 at 3:01
  • Not able to get to computer to test right now but "detect" might require relative coordinates, not absolute coordinates. – RS_Mind Jul 23 '17 at 5:37
  • 1. I think that the chunk not being loaded is the most likely cause. Try going near the coordinates you entered. Does it still happen then? Maybe you mixed up positive and negative coordinates or so? 2. Execute is completely ok for this. Why use two commands blocks if you can use one? 3. detect does not require relative coordinates. – Fabian Röling Jul 23 '17 at 8:42
  • @Fabian I'm not saying execute won't work, but rather, my point is that it's easier to debug two simple commands compared to one complex command. – MBraedley Jul 23 '17 at 12:51
  • I played with that command. I initially got the same failed to execute detect. I removed the 'minecraft:' so it was detect 'air' and it started to function properly. I am not sure why. I then put your command into another command block in another position and it worked as is. I had another one not functioning and I put it back to impulse and then to repeat again and it functioned properly. You might try to move command block or remove 'minecraft:' or set it to impulse/need redstone and back. It definitely seems erratic and I don't understand why so I didn't post as an answer. – IronAnvil Jul 23 '17 at 15:30
0

Try this if you are in 1.13:

/execute as @p if block -712 58 -1887 minecraft:air run setblock -729 56 -1884 minecraft:redstone_block replace

In 1.12.2 I tried:

execute @p ~ ~ ~ detect -712 58 -1887 air 0 setblock -729 56 -1884 minecraft:redstone_block

and it worked. It only returned that message if there was already a redstone block there. Did you check if there was one or just check the command block? BTW it worked when I used minecraft:air instead of air as well.

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.