I am trying to find out how to destroy certain blocks in the range of an entity. Example

Command block detects that cracked stone bricks is in range of the TNT item entity and then destroys the cracked stone bricks.

  • Are you trying to get the TNT to destroy only the cracked stone bricks? I think the question is unclear. – sensiwoo Mar 19 '16 at 16:05
  • @sensiwoo yes that's right – sevn Mar 19 '16 at 16:33

It's pretty simple. All you need are two commands in repeat command blocks, and to add a new scoreboard objective.

First, run this command once:

/scoreboard objectives add TNT dummy

Then in the first command block (set to repeat mode):

/scoreboard players set @e[type=Item] TNT 1 {Item:{id:minecraft:tnt}}

Finally, in a second command block (also set to repeat):

/execute @e[score_TNT_min=1] ~ ~ ~ fill ~2 ~2 ~2 ~-2 ~-2 ~-2 minecraft:air 0 replace minecraft:stonebrick 2

This will replace any stone bricks in a 5x5x5 cube around the item with air. I haven't tested this, so it might not work, but I think it will. Good luck!

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.