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/testforblock: Difference between revisions

From SAS Gaming Wiki
imported>LauraFii
History: split
 
SyncBot (talk | contribs)
Remove broken links to missing pages
Line 27: Line 27:


{{argument|be=1|blockStates: block states|BlockStateCommandParam}}
{{argument|be=1|blockStates: block states|BlockStateCommandParam}}
: Specifies the [[Minecraft:block states]] to match when testfor.
: Specifies the block states to match when testfor.
: {{Arg desc|be=BlockStateCommandParam}}
: {{Arg desc|be=BlockStateCommandParam}}


Line 48: Line 48:
==Examples==
==Examples==


* To test if the block at (0,64,0) is [[Minecraft:white wool]]:
* To test if the block at (0,64,0) is white wool:
** <code>testforblock 0 64 0 wool</code>
** <code>testforblock 0 64 0 wool</code>
** <code>testforblock 0 64 0 white_wool</code>
** <code>testforblock 0 64 0 white_wool</code>
Line 61: Line 61:
|{{HistoryLine|Java}}
|{{HistoryLine|Java}}
|{{HistoryLine||1.7.2|dev=13w37a|Added {{cmd|testforblock|link=none}}.}}
|{{HistoryLine||1.7.2|dev=13w37a|Added {{cmd|testforblock|link=none}}.}}
|{{HistoryLine||1.11|dev=16w32a|Added [[Minecraft:block state]] support to {{cmd|testforblock|link=none}}.}}
|{{HistoryLine||1.11|dev=16w32a|Added block state support to {{cmd|testforblock|link=none}}.}}
|{{HistoryLine||1.13|dev=17w45a|Removed {{cmd|testforblock|link=none}} in favor of {{cmd|execute if}}.}}
|{{HistoryLine||1.13|dev=17w45a|Removed {{cmd|testforblock|link=none}} in favor of {{cmd|execute if}}.}}
}}
}}
Line 70: Line 70:
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|testforblock|link=none}}.}}  
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|testforblock|link=none}}.}}  
|{{HistoryLine|bedrock}}
|{{HistoryLine|bedrock}}
|{{HistoryLine||1.18.0|dev=beta 1.18.0.20|Added [[Minecraft:block state]] support.}}
|{{HistoryLine||1.18.0|dev=beta 1.18.0.20|Added block state support.}}
|{{HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>dataValue: int</code> argument.}}
|{{HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>dataValue: int</code> argument.}}
}}
}}
Line 81: Line 81:
{{Navbox commands}}
{{Navbox commands}}


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

Revision as of 15:45, 9 April 2026

Template:Distinguish Template:Exclusive Template:Outdated Template:Infobox command

Tests whether a certain Minecraft:block is in a specific location.

Syntax

testforblock <position: x y z> <tileName: Block> [blockStates: block states]

Arguments

Template:Argument

Specifies the Minecraft:coordinates of the block to test.
Template:Arg desc

Template:Argument

Specifies the block to test for.
Template:Arg desc

Template:Argument

Specifies the block states to match when testfor.
Template:Arg desc

Result

Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table

Output

Template:Output table Template:Output table Template:Output table Template:Output table

Examples

  • To test if the block at (0,64,0) is white wool:
    • testforblock 0 64 0 wool
    • testforblock 0 64 0 white_wool
  • To test if the block at (0,64,0) is Minecraft:stone:
    • testforblock 0 64 0 stone []
  • To test if the block below is a Minecraft:jukebox:
    • testforblock ~ ~-1 ~ jukebox

History

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

External links

Navigation

Template:Navbox commands

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