/setblock
Places a block at a specified position in the world. Can optionally destroy the existing block, keep it, or replace it.
Syntax
/setblock <pos> <block> [destroy|keep|replace]Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pos | block_pos | Required | The coordinates where the block should be placed. |
| block | block_state | Required | The block to place, optionally with block states (e.g., oak_stairs[facing=east]). |
| mode | literal | Optional | destroy = drops old block as item; keep = only places if target is air; replace = overwrites (default). |
Examples
/setblock ~ ~-1 ~ minecraft:diamond_blockPlaces a diamond block directly below you.
/setblock 0 64 0 minecraft:oak_stairs[facing=south,half=top] destroyPlaces a top-half south-facing oak stair at 0,64,0, destroying whatever was there.
/setblock ~ ~ ~ airRemoves the block at your position by replacing it with air.
Common Mistakes
- Using 'keep' mode and not realizing it silently fails if the position already has a non-air block.
- Forgetting block state syntax uses square brackets and key=value pairs separated by commas.
Notes
Block states are specified in square brackets, e.g., chest[facing=north]. Use /setblock with air to effectively delete a block.
Related Commands
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting