Vivian’s Minecraft ToolsSMALL TOOLS. BIG ADVENTURES.
MINECRAFT JAVA EDITION

How to use setblock (Java Edition)

Place a single block at a position and set properties such as its facing or whether it is waterlogged.

Basic syntax

/setblock <x> <y> <z> <block> [replace|keep|destroy|strict]

This syntax applies to Java 1.13 and later. The <…> arguments are required, and the final […] argument is optional.

ArgumentMeaning
x y zThe placement position. 100 64 200 is absolute, and ~ ~-1 ~ is one block below the execution position.
blockThe block ID, optionally followed by [states] and then block entity {NBT}.

Examples

Place stone one block below you

/setblock ~ ~-1 ~ minecraft:stone

Place east-facing stairs

/setblock ~ ~ ~2 minecraft:oak_stairs[facing=east,half=bottom]

Place glass only if the position is air

/setblock ~ ~ ~2 minecraft:glass keep

Placement modes

ArgumentMeaning
replaceReplaces the existing block. This is the default.
keepPlaces a block only where the target is air.
destroyBreaks the original block before placing the new one. Drops depend on the block and game settings.
strictJava 1.21.5 and later. Places the block without triggering block or shape updates.

Minecraft Java 1.21.5 release notes

Block states and version differences

Write properties together, as in [facing=east,half=bottom]. Available properties and values depend on the block.

In Java 1.21.5 and later, specify {} to explicitly clear existing block entity data. For example, /setblock ~ ~ ~2 minecraft:chest{}.

Java 1.12.2 and earlier use data values or older state syntax, depending on the version and block. Select your release in the generator.

Make your own command

Open generator →
Ad space (preview)