Commands/setblock

Changes a block to another block.
== Syntax ==
* Java Edition
: setblock <pos> <block> [destroy|keep|replace] 
* Bedrock Edition
: setblock <position: x y z> <tileName: Block> <blockStates: block states> [destroy|keep|replace]
: setblock <position: x y z> <tileName: Block> [destroy|keep|replace]
== Arguments ==
: Specifies the position of the block to be changed.
: 
: Specifies the new block.
: 
: 
: Specifies the block states to use for the block.
: 
: Specifies how to handle the block change. Must be one of:
:* destroy — The old block drops both itself and its contents (as if destroyed by a player). Plays the appropriate block breaking noise.
:* keep — Only air blocks are changed (non-air blocks are unchanged).
:* replace — The old block drops neither itself nor any contents. Plays no sound.
: If not specified, defaults to replace.
== Result ==
== Output ==
== Examples ==
* Put a chest facing east at your feet
** setblock ~ ~ ~ chest[facing=east]
** setblock ~ ~ ~ chest ["facing_direction"=5]
* Place a sign next to it 
** setblock ~ ~ ~-1 birch_sign{Text1:'"My chest"',Text2:'"Do not open!"'} (Note the two sets of quotes around the text. They are required.)
* Put a top quartz slab at the top of your head
** setblock ~ ~2 ~ quartz_slab[type=top]
** setblock ~ ~2 ~ stone_slab ["stone_slab_type"="quartz","top_slot_bit"=true]
== See also ==
* — modifies the data tags of a block or entity
* — copies blocks from one region to another
* — fills a region with a block
== History ==
== References ==
de:Befehl/setblock
es:Comandos/setblock
ja:コマンド/setblock
ru:Команды консоли/setblock
uk:Команди консолі/setblock
zh:命令/setblock