I am trying the testfor command on a block, is that possible? When it is mined , I want the testfor to turn off.

enter image description here

For example, when this green wool block is mined up, the command block that has the testfor command will turn off, for it can't find the block there. Can this work somehow?


2 Answers 2


You should have the following command in a command block on clock of some sort or a repeating command block if you are in 1.9:

Testforblock x y z wool 5 

Replace the X,Y, and Z with the coordinates of the block. Because colored wool doesn't have different names for each color, you must use the damage value to testfor the color. The minecraft wiki page on damage values shows that green is value 5 for wool. When it doesn't detect it, the comparator will turn off.

Note: if you put -1 as the damage value it will do it no matter what damage value the block is

Alternatively, this command can be used but the comparator will turn on when it breaks:

Testforblock x y z air 0

Air doesn't have data values so 0 or -1 is all you need.


Found it:

testforblock <x> <y> <z> <TileName> [dataValue] [dataTag]

Here: How to testfor blocks not people

  • Don't copy answers from one question to another -- flag the question as duplicate instea.
    – pppery
    Commented Jun 11, 2020 at 16:51

Not the answer you're looking for? Browse other questions tagged .