TransWikia.com

How to testfor blocks not people

Arqade Asked by PaulWebster1 on January 16, 2021

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.

2 Answers

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

Answered by SirBenet on January 16, 2021

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

Answered by ExpertCoder14 on January 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP