WorldBedrockEducation
/testforblock
Checks if the block at a coordinate matches a given block (and optional data value), reporting success for comparator output. On Java the equivalent is /execute if block.
Syntax
Parameters
- position
- coords
- Block position to check.
- block
- block ID
- Expected block.
- dataValueoptional
- integer
- Expected block data/aux value.
Examples
Check whether the block below you is stone.
Permission level
/testforblock requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.