Minecraft:Commands/testforblocks: Difference between revisions
More actions
Remove broken links to missing pages |
Fix template calls: add MC/ prefix |
||
| Line 1: | Line 1: | ||
{{ | {{MC/Distinguish|Commands/testforblock}} {{MC/Exclusive|bedrock|education}} | ||
{{outdated|edition=java}} | {{outdated|edition=java}} | ||
{{Infobox command | {{Infobox command | ||
| Line 15: | Line 15: | ||
==Arguments== | ==Arguments== | ||
{{ | {{MC/Argument|be=1|begin: x y z|CommandPosition}} and {{MC/Argument|be=1|end: x y z|CommandPosition}} | ||
: Specifies two opposing corners of the region to use as the pattern to test for (the "source region"). | : Specifies two opposing corners of the region to use as the pattern to test for (the "source region"). | ||
: {{ | : {{MC/Arg desc|be=CommandPosition}} | ||
: Block position is the [[Minecraft: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 (x<sub>greater</sub> - x<sub>lesser</sub> + 1) × (y<sub>greater</sub> - y<sub>lesser</sub> + 1) × (z<sub>greater</sub> - z<sub>lesser</sub> + 1). For example, <code>0 0 0 0 0 0</code> has a 1-block volume, and <code>0 0 0 1 1 1</code> and <code>1 1 1 0 0 0</code> both identify the same region with an 8-block volume. | : Block position is the [[Minecraft: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 (x<sub>greater</sub> - x<sub>lesser</sub> + 1) × (y<sub>greater</sub> - y<sub>lesser</sub> + 1) × (z<sub>greater</sub> - z<sub>lesser</sub> + 1). For example, <code>0 0 0 0 0 0</code> has a 1-block volume, and <code>0 0 0 1 1 1</code> and <code>1 1 1 0 0 0</code> both identify the same region with an 8-block volume. | ||
{{ | {{MC/Argument|be=1|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. | : 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. | ||
: {{ | : {{MC/Arg desc|be=CommandPosition}} | ||
<code>masked|all</code> | <code>masked|all</code> | ||
| Line 42: | Line 42: | ||
== Output == | == Output == | ||
{{Output table|onlybe=1}} | {{MC/Output table|onlybe=1}} | ||
{{Output table|On fail|0}} | {{MC/Output table|On fail|0}} | ||
{{Output table|On success|1}} | {{MC/Output table|On success|1}} | ||
{{Output table}} | {{MC/Output table}} | ||
== History == | == History == | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|java}} | |{{MC/HistoryLine|java}} | ||
|{{HistoryLine||1.8|dev=14w07a|Added {{ | |{{HistoryLine||1.8|dev=14w07a|Added {{MC/Cmd|testforblocks|link=none}}.}} | ||
|{{HistoryLine||1.13|dev=17w45a|Removed {{ | |{{HistoryLine||1.13|dev=17w45a|Removed {{MC/Cmd|testforblocks|link=none}}.}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|pocket alpha}} | |{{MC/HistoryLine|pocket alpha}} | ||
|{{HistoryLine||v0.16.0|dev=build 1|Added {{ | |{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|testforblocks|link=none}}.}} | ||
}} | }} | ||
| Line 66: | Line 66: | ||
== Navigation == | == Navigation == | ||
{{Navbox commands}} | {{MC/Navbox commands}} | ||
de:Befehl/testforblocks | de:Befehl/testforblocks | ||
Latest revision as of 20:14, 9 April 2026
Template:Hatnote Script error: No such module "Exclusive". Template:Outdated Template:Infobox command
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").
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|block_pos}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- Block position is the Minecraft: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.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|block_pos}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
masked|all
- Specifies how to match blocks. Must be one of:
all— every block in the source and destination regions must match exactly.masked— Minecraft:air blocks in the source region match any block in the destination region.
- If not specified, defaults to
all.
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
History
Java Edition
Bedrock Edition
External links
de:Befehl/testforblocks es:Comandos/testforblocks ja:コマンド/testforblocks pt:Comandos/testforblocks ru:Команды консоли/testforblocks zh:命令/testforblocks