I'm creating a map where the player gets four pieces of wool ( Red Black Blue Green ) and I need it so if they place the block anywhere it will trigger a command block.

I have tried:

  • /testfor @a {SelectedItem:{id:minecraft:wool,Damage:14s}} < I wanted to manipulate this but I had no idea how.

  • scoreboard objectives: the first thing I tried because I hoped there was a stat.blockplaced.wool:14 or something along those lines but i Had no luck.

  • /testforblocks: So I am unsure of the way to use this. I would have hoped it was something like this: /testforblocks 1 1 1 -1 -1 -1 minecraft:wool 14 but no it didnt work that way. Instead it has this: /testforblocks x1 y1 z1 x2 y2 z2 x y z [mode] which I believe I have to make a clone of the map and then it will testfor a block placed? I am unsure

  • /testforblock: now this would probably work but it involves a lot of command blocks and when I tried to do it things started getting muddled up

  • Instead of wool I thought there might be a way to implement the sign clickevent tag into different kinds of swords but to no avail.

  • /execute @a ~ ~ ~ /testforblock: I though of this and then realised it would still need a region

  • my other idea was to do this /testforblock <playername>[xd=,zd=,yd=] but i dismissed that thought.

So I've tried to this by myself and nothing has really worked. The most promising is just making a bunch of testforblock commands.


Just had a more promising idea of using armor stands with marker disabled to testforblock.

2nd Edit

Alright so I filled the area I need with no marker invisible armor stands. Then I used this command:

/execute @e[type=armor_stand] ~ ~ ~ /testforblock ~ ~ ~ minecraft:wool 14

I ran it in a repeating command block and got this error:

[12:55:37] Failed to execute '/testforblock ~ ~ ~ minecraft:wool 14' as testfor

So new question: How do I fix this error?

  • Ok I think the armor stand idea worked. – Reflexive Mar 8 '17 at 12:41

There are a few ways to detect a certain block in an area:

If you just want to detect whether or not a certain block is inside an area and if you don't mind having the block destroyed, you can use this command:

/execute @a ~ ~ ~ fill ~-10 ~-10 ~-10 ~10 ~10 ~10 air 0 replace wool 14

You can detect the block placed using a comparator or a conditional chain command block.

If you, however, want to know where the block is placed and or keep the block, you can use this more complex approach.

/execute @a ~ ~ ~ fill ~-8 ~-8 ~-8 ~8 ~8 ~8 structure_void 0 keep

#Repeat this section for how many types of blocks you want to test for
/execute @a ~ ~ ~ fill ~-8 ~-8 ~-8 ~8 ~8 ~8 air 0 replace wool 11
/execute @a ~ ~ ~ fill ~-8 ~-8 ~-8 ~8 ~8 ~8 command_block 0 keep {auto:1,Command:"summon armor_stand ~ ~ ~ {Invisible:1,NoGravity:1,Marker:1,Tags:["wool11"]}"}

/execute @a ~ ~ ~ fill ~-8 ~-8 ~-8 ~8 ~8 ~8 air 0 replace wool 14
/execute @a ~ ~ ~ fill ~-8 ~-8 ~-8 ~8 ~8 ~8 command_block 0 keep {auto:1,Command:"summon armor_stand ~ ~ ~ {Invisible:1,NoGravity:1,Marker:1,Tags:["wool14"]}"}


/execute @a ~ ~ ~ fill ~-8 ~-8 ~-8 ~8 ~8 ~8 air 0 replace structure_void
/blockdata ~2 ~ ~ {auto:1}
/blockdata ~1 ~ ~ {auto:0}
[Impulse] /execute @a ~ ~ ~ fill ~-10 ~-10 ~-10 ~10 ~10 ~10 air replace command_block
/execute @e[type=armor_stand,tag=wool11] ~ ~ ~ say You placed blue wool!
/execute @e[type=armor_stand,tag=wool14] ~ ~ ~ say You placed red wool!
  • 1
    Thats very good and I needed the block deleted anyway. +1 and I will accept if it works without issue ;) – Reflexive Mar 8 '17 at 13:24
  • That worked perfectly. Very smart. Good luck. – Reflexive Mar 8 '17 at 13:26

Set aside a volume corresponding to the volume you want tested, /fill it with a specific (different) block type, say, stone. /clone the volume tested with filtering set to the block type you want to test for (say, wool). Then perform /execute if blocks on the duplicate volume checking for stone. If any wool got cloned into it, the execute will fail.

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.