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/setblock: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Remove broken links to missing pages
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
Line 16: Line 16:


== Arguments ==
== Arguments ==
{{argument|pos|block_pos|position: x y z|CommandPosition}}
{{MC/Argument|pos|block_pos|position: x y z|CommandPosition}}
: Specifies the position of the block to be changed.
: Specifies the position of the block to be changed.
: {{arg desc|je=block_pos|be=CommandPosition}}
: {{MC/Arg desc|je=block_pos|be=CommandPosition}}


{{argument|block|block_state|tileName: Block|enum}}
{{MC/Argument|block|block_state|tileName: Block|enum}}
: Specifies the new block.
: Specifies the new block.
: {{arg desc|je=block_state|be=Block}}
: {{MC/Arg desc|je=block_state|be=Block}}


{{el|be|short=1}}: {{argument|be=1|blockStates: block states|BlockStateCommandParam}}
{{MC/El|be|short=1}}: {{MC/Argument|be=1|blockStates: block states|BlockStateCommandParam}}
: Specifies the block states to use for the block.
: Specifies the block states to use for the block.
: {{Arg desc|be=BlockStateCommandParam}}
: {{MC/Arg desc|be=BlockStateCommandParam}}


{{code|destroy{{!}}keep{{!}}replace}} and {{code|destroy{{!}}keep{{!}}replace{{!}}strict}}
{{code|destroy{{!}}keep{{!}}replace}} and {{code|destroy{{!}}keep{{!}}replace{{!}}strict}}
Line 50: Line 50:
== Output ==
== Output ==


{{Output table}}
{{MC/Output table}}
{{Output table|edition=je|On fail|0|0|0}}
{{MC/Output table|edition=je|On fail|0|0|0}}
{{Output table|On success|1|1|1}}
{{MC/Output table|On success|1|1|1}}
{{Output table|edition=be|On fail|0}}
{{MC/Output table|edition=be|On fail|0}}
{{Output table|On success|1}}
{{MC/Output table|On success|1}}
{{Output table}}
{{MC/Output table}}


== Examples ==
== Examples ==
Line 61: Line 61:
** <code>setblock ~ ~ ~ chest[facing=east]</code>{{only|java}}
** <code>setblock ~ ~ ~ chest[facing=east]</code>{{only|java}}
** <code>setblock ~ ~ ~ chest ["minecraft:cardinal_direction"="east"]</code>{{only|bedrock}}
** <code>setblock ~ ~ ~ chest ["minecraft:cardinal_direction"="east"]</code>{{only|bedrock}}
* Place a sign next to it {{in|java}}
* Place a sign next to it {{MC/In|java}}
** <code>setblock ~ ~ ~-1 birch_sign{Text1:'"My chest"',Text2:'"Do not open!"'}</code> (Note the two sets of quotes around the text. They are required.)
** <code>setblock ~ ~ ~-1 birch_sign{Text1:'"My chest"',Text2:'"Do not open!"'}</code> (Note the two sets of quotes around the text. They are required.)
* Put a top quartz slab at the top of your head
* Put a top quartz slab at the top of your head
Line 70: Line 70:
=== ''Java Edition'' ===
=== ''Java Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|java}}
|{{MC/HistoryLine|java}}
|{{HistoryLine||1.7.2|dev=13w37a|Added {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.7.2|dev=13w37a|Added {{MC/Cmd|setblock|link=none}}.}}
|{{HistoryLine||1.11|dev=16w32a|Added block state support to {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.11|dev=16w32a|Added block state support to {{MC/Cmd|setblock|link=none}}.}}
|{{HistoryLine||1.16|dev=20w06a|{{cd|/setblock ~ ~ ~ air destroy}} now can destroy liquids.<ref>{{bug|MC-163286|resolution=Fixed}}</ref>}}
|{{HistoryLine||1.16|dev=20w06a|{{MC/Cd|/setblock ~ ~ ~ air destroy}} now can destroy liquids.<ref>{{bug|MC-163286|resolution=Fixed}}</ref>}}
|{{HistoryLine||1.21.5|dev=25w02a|The behavior of {{cmd|setblock}} command has changed in how it handles block entity data.|Accepts a new option: <code>strict</code>.|New syntax for commands to use the new strict option.}}
|{{HistoryLine||1.21.5|dev=25w02a|The behavior of {{MC/Cmd|setblock}} command has changed in how it handles block entity data.|Accepts a new option: <code>strict</code>.|New syntax for commands to use the new strict option.}}
}}
}}


=== ''Bedrock Edition'' ===
=== ''Bedrock Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|pocket alpha}}
|{{MC/HistoryLine|pocket alpha}}
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|setblock|link=none}}.}}
|{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|setblock|link=none}}.}}
|{{HistoryLine|bedrock}}
|{{MC/HistoryLine|bedrock}}
|{{HistoryLine||1.16.210|dev=beta 1.16.210.53|Added block state support to {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.16.210|dev=beta 1.16.210.53|Added block state support to {{MC/Cmd|setblock|link=none}}.}}
|{{HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>tileData: int</code> argument.}}
|{{MC/HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>tileData: int</code> argument.}}
}}
}}


== See also ==
== See also ==
* {{cmd|data}} — modifies the data tags of a block or entity
* {{MC/Cmd|data}} — modifies the data tags of a block or entity
* {{cmd|clone}} — copies blocks from one region to another
* {{MC/Cmd|clone}} — copies blocks from one region to another
* {{cmd|fill}} — fills a region with a block
* {{MC/Cmd|fill}} — fills a region with a block


== References ==
== References ==
Line 99: Line 99:


== Navigation ==
== Navigation ==
{{Navbox commands}}
{{MC/Navbox commands}}


de:Befehl/setblock
de:Befehl/setblock

Latest revision as of 20:13, 9 April 2026

Template:Infobox command Changes a Minecraft:block to another block.

Syntax

  • Java Edition
setblock <pos> <block> [destroy|keep|replace|strict]
  • 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

Template:El<pos>: block_pos
Template:El: position: x y z: CommandPosition

Specifies the position of the block to be changed.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|block_pos}}{{#vardefine:be-arg|block_pos}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

Template:El<block>: block_state
Template:El: tileName: Block: enum

Specifies the new block.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|block_state}}{{#vardefine:be-arg|block_be}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
  1. REDIRECT Template:Edition

Template:Rcat: blockStates: block states: BlockStateCommandParam

Specifies the block states to use for the block.
{{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|blockstatecommandparam}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

Template:Code and Template:Code

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 Minecraft:air blocks are changed (non-air blocks are unchanged).
  • replace — The old block drops neither itself nor any contents. Plays no sound.
  • strict — Place blocks as-is without triggering block updates and shape updates.
If not specified, defaults to replace.

Result

Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table

Output

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|0}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|1}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

Examples

  • Put a chest facing east at your feet
  • Place a sign next to it in Template:Editions
    • 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

History

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

See also

  1. REDIRECT Template:Command

Template:Redr — modifies the data tags of a block or entity

  1. REDIRECT Template:Command

Template:Redr — copies blocks from one region to another

  1. REDIRECT Template:Command

Template:Redr — fills a region with a block

References

<references/>

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/setblock ja:コマンド/setblock pt:Comandos/setblock ru:Команды консоли/setblock uk:Команди консолі/setblock zh:命令/setblock