/testforblocks
< Commands
Not to be confused with Commands/testforblock.
This feature is exclusive to Bedrock Edition and Minecraft Education.
This page describes content that has been removed from the game.
This feature was present in earlier versions of Java Edition, but has since been removed.
/testforblocks| Permission level required |
1 |
|---|---|
| Restrictions |
Cheat only |
{
"title": "<code>/testforblocks</code>",
"rows": [
{
"field": "1",
"label": "(link to Permission level article, displayed as Permission level<br>required)"
},
{
"field": "(link to Option article, displayed as Cheat) only<br>",
"label": "(link to Commands#Restrictions article, displayed as Restrictions)"
}
],
"invimages": [],
"images": []
}
Tests whether the blocks in two regions match. Shows the number of matching blocks (the total number of blocks in all mode, or the number of source region non-air blocks in masked mode).
Syntax
testforblocks <begin: x y z> <end: x y z> <destination: x y z> [masked|all]
Arguments
begin: x y z: CommandPosition and end: x y z: CommandPosition
- Specifies two opposing corners of the region to use as the pattern to test for (the "source region").
- Must be a three-dimensional coordinates composed of
<X>,<Y>and<Z>, each of which must be a single-precision floating-point number or tilde and caret notation. - Block position is the coordinates of the point at the lower northwest corner of a block. Because of this, the lesser coordinates of each axis falls right on the region boundary, but the greater coordinates are one block from the boundary, and the block volume of the source region is (xgreater - xlesser + 1) × (ygreater - ylesser + 1) × (zgreater - zlesser + 1). For example,
0 0 0 0 0 0has a 1-block volume, and0 0 0 1 1 1and1 1 1 0 0 0both identify the same region with an 8-block volume.
destination: x y z: CommandPosition
- Specifies the lower northwestern corner (the corner with the most-negative values) of the region to be checked (the "destination region"). Source and destination regions may overlap.
- Must be a three-dimensional coordinates composed of
<X>,<Y>and<Z>, each of which must be a single-precision floating-point number or tilde and caret notation.
masked|all
- Specifies how to match blocks. Must be one of:
all— every block in the source and destination regions must match exactly.masked— air blocks in the source region match any block in the destination region.
- If not specified, defaults to
all.
Result
| Command | Trigger | Bedrock Edition |
|---|---|---|
| Any | The command is incomplete, or any argument is not specified correctly. | Unparseable |
| One or both specified regions are unloaded or out of the world. | Failed | |
| The block volume of the source region is greater than 786432. | ||
| The source and destination regions do not match. | ||
| Any | Otherwise | Successful |
Output
| Command | Edition | Situation | Success Count |
|---|---|---|---|
| Any | Bedrock Edition | On fail | 0 |
| On success | 1 |
History
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.8 | 14w07a | Added /testforblocks. | |||||
| 1.13 | 17w45a | Removed /testforblocks. | |||||
| Pocket Edition Alpha | |||||||
| v0.16.0 | build 1 | Added /testforblocks. | |||||