WorldBedrockEducation
/testforblocks
Compares the blocks in one region against another and reports whether they match (all blocks, or masked to ignore air). Drives comparator output in detection contraptions. The Java equivalent is /execute if blocks.
What is /testforblocks used for?
What /testforblocks is for
Compares the blocks in two regions and reports whether they match (all blocks, or masked to ignore air), driving comparator output.
When to use /testforblocks
Detect whether a structure has been built or changed in command-block contraptions on Bedrock. The Java equivalent is /execute if blocks.
Syntax
Parameters
- begin / end
- coords
- Corners of the source region.
- destination
- coords
- Lower corner of the region to compare against.
- modeoptional
- literal
- all or masked (ignore air).
Examples
Check whether two 5×5×5 regions match, ignoring air.
Permission level
/testforblocks 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.