Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/testforblocks: Difference between revisions

From SAS Gaming Wiki
imported>LauraFii
History: split
 
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{distinguish|Commands/testforblock}} {{exclusive|bedrock|education}}
{{MC/Distinguish|Commands/testforblock}} {{MC/Exclusive|bedrock|education}}
{{outdated|edition=java}}  
{{outdated|edition=java}}  
{{Infobox command
{{Infobox command
Line 7: Line 7:
}}
}}


Tests whether the [[Minecraft:blocks]] in two regions match. Shows the number of matching blocks (the total number of blocks in <code>all</code> mode, or the number of source region non-air blocks in <code>masked</code> mode).
Tests whether the blocks in two regions match. Shows the number of matching blocks (the total number of blocks in <code>all</code> mode, or the number of source region non-air blocks in <code>masked</code> mode).


==Syntax==
==Syntax==
Line 15: Line 15:
==Arguments==
==Arguments==


{{argument|be=1|begin: x y z|CommandPosition}} and {{argument|be=1|end: x y z|CommandPosition}}
{{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").
: {{arg desc|be=CommandPosition}}
: {{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.


{{argument|be=1|destination: x y z|CommandPosition}}
{{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.
: {{arg desc|be=CommandPosition}}
: {{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 {{cmd|testforblocks|link=none}}.}}
|{{HistoryLine||1.8|dev=14w07a|Added {{MC/Cmd|testforblocks|link=none}}.}}
|{{HistoryLine||1.13|dev=17w45a|Removed {{cmd|testforblocks|link=none}}.}}
|{{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 {{cmd|testforblocks|link=none}}.}}
|{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|testforblocks|link=none}}.}}
}}
}}


Line 66: Line 66:


== Navigation ==
== Navigation ==
{{Navbox commands}}
{{MC/Navbox commands}}


[[Minecraft:de:Befehl/testforblocks]]
de:Befehl/testforblocks
[[Minecraft:es:Comandos/testforblocks]]
es:Comandos/testforblocks
[[Minecraft:ja:コマンド/testforblocks]]
ja:コマンド/testforblocks
[[Minecraft:pt:Comandos/testforblocks]]
pt:Comandos/testforblocks
[[Minecraft:ru:Команды консоли/testforblocks]]
ru:Команды консоли/testforblocks
[[Minecraft:zh:命令/testforblocks]]
zh:命令/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 0 has a 1-block volume, and 0 0 0 1 1 1 and 1 1 1 0 0 0 both 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.
  • maskedMinecraft: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

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/testforblocks es:Comandos/testforblocks ja:コマンド/testforblocks pt:Comandos/testforblocks ru:Команды консоли/testforblocks zh:命令/testforblocks