How to testfor blocks not people

How to testfor blocks not people - Man in Gray Crew Neck T-shirt Wearing Brown Cap

how do I testfor blocks? like if I put down stone near a command block with a comparator attached to it and it will activate a piston connected by the comparator on the command block? please answer.



Best Answer

The command you want is /testforblock. The syntax of it is:

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

So to test for a stone block at X=10, Y=64, Z=10, the command would be:

testforblock 10 64 10 stone



Pictures about "How to testfor blocks not people"

How to testfor blocks not people - Assorted Wooden Alphabets Inside the Crate
How to testfor blocks not people - Man Sitting at the Edge of Rock Facing the Lake during Day
How to testfor blocks not people - White Metal High-rise Viewing Deck Building



How do you test for a specific block in Minecraft?

You can test whether there is a certain block at a specific location in the game using the /testforblock command in Minecraft....TestForBlock Command in Minecraft Java Edition (PC/Mac)
  • x y z is the coordinate to test. ...
  • block is name of the block to test for. ( ...
  • dataValue is optional. ...
  • dataTag is optional.


  • How do you detect a block?

    No item would drop and the block break would not be detected. If the player simply drops an item, a "block break" would be detected. If a mob dies and drops items, a "block break" would be detected. (But who knows, maybe you have a large bedrock room filled with nothing but sand; this solution would work.)



    How to detect a player using command blocks! | /execute command tutorial for 1.16 Minecraft Java




    More answers regarding how to testfor blocks not people

    Answer 2

    1.13+ Update

    /testforblock has been deprecated. New command is /execute if block.

    /execute if block 10 64 10 stone
    

    You can now run a success command directly in the same command:

    /execute if block 10 64 10 stone run give @p diamond_shovel
    

    You can also use unless to negate the check:

    /execute unless block 10 64 10 stone run give @p diamond_shovel
    

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: ANTONI SHKRABA production, Daria Shevtsova, Riccardo, Pixabay