
Command
/setblock
Places a block at a position, replacing whatever is there.
| /setblock <pos> <block> [(destroy|keep|replace|strict)] |
| Argument | Kind of value | What to type |
|---|---|---|
| <pos> | Block position | The position of the block to change, as three coordinates. ~ is relative to where the command runs and ^ is relative to the direction faced. |
| <block> | Block | The block to place: its id, optionally with block states in square brackets and block data in curly braces. |
| Permission level | 2: operators, worlds with cheats on, command blocks and functions |
| Works in | Singleplayer with cheats enabled, multiplayer servers, command blocks and functions. Needs permission level 2 (gamemasters): operators, players in a world with cheats enabled, command blocks and functions. |
| Result | Reports "Changed the block at X, Y, Z". The number /execute store saves is 1. |
| replace (default) | Swaps the old block for the new one. The old block drops nothing. This is what happens when no mode is written. |
| destroy | Breaks the old block first, as if it had been mined, so it drops its items and shows the breaking effect. Then the new block is placed. |
| keep | Places the block only if the position currently holds Air. Otherwise the command fails with "Could not set the block". |
| strict | Places the block exactly as written, without it adjusting its shape to the blocks around it and without updating neighboring blocks. |
| Nothing changed | If the position already holds exactly that block, the command fails with "Could not set the block". |
| Position limits | The position must be in a loaded chunk ("That position is not loaded") and inside the world's build height ("That position is out of this world!"). |
| Block states and data | Block states go in square brackets right after the id, for example minecraft:oak_stairs[facing=east,half=top]. States that are not written keep their default value, and in every mode except strict the block still adjusts to its neighbors. Block tags (ids starting with #) are not allowed. |
/setblock ~ ~ ~ minecraft:stonePlaces Stone at your position.
/setblock ~ ~-1 ~ minecraft:diamond_block replaceReplaces the block under your feet with a Block of Diamond.
/setblock 10 64 10 minecraft:oak_stairs[facing=east]Places Oak Stairs facing east at the coordinates 10, 64, 10.
/setblock ~ ~1 ~ minecraft:air destroyBreaks the block one above your position so that it drops its items.
/setblock ~ ~ ~ minecraft:torch keepPlaces a Torch at your position only if there is Air.
/setblock ~ ~2 ~ minecraft:redstone_lamp[lit=true] strictPlaces a lit Redstone Lamp two blocks above you without any block updates.

