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

From SAS Gaming Wiki
Revision as of 15:45, 9 April 2026 by SyncBot (talk | contribs) (Remove broken links to missing pages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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