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
imported>MinecraftBedrockPlayer7
mNo edit summary
 
SyncBot (talk | contribs)
Remove broken links to missing pages
Line 4: Line 4:
* 2 {{only|java|short=1}}
* 2 {{only|java|short=1}}
* 1 {{only|bedrock|short=1}}
* 1 {{only|bedrock|short=1}}
|others=[[Minecraft:Cheat]] only{{only|bedrock|short=1}}
|others=Cheat only{{only|bedrock|short=1}}
}}
}}
Changes a [[Minecraft:block]] to another block.
Changes a [[Minecraft:block]] to another block.
Line 25: Line 25:


{{el|be|short=1}}: {{argument|be=1|blockStates: block states|BlockStateCommandParam}}
{{el|be|short=1}}: {{argument|be=1|blockStates: block states|BlockStateCommandParam}}
: Specifies the [[Minecraft:block states]] to use for the block.
: Specifies the block states to use for the block.
: {{Arg desc|be=BlockStateCommandParam}}
: {{Arg desc|be=BlockStateCommandParam}}


{{code|destroy{{!}}keep{{!}}replace}} and {{code|destroy{{!}}keep{{!}}replace{{!}}strict}}
{{code|destroy{{!}}keep{{!}}replace}} and {{code|destroy{{!}}keep{{!}}replace{{!}}strict}}
: Specifies how to handle the block change. Must be one of:
: Specifies how to handle the block change. Must be one of:
:* <code>destroy</code> — The old block [[Minecraft:drops]] both itself and its contents (as if destroyed by a [[Minecraft:player]]). Plays the appropriate block breaking noise.
:* <code>destroy</code> — The old block drops both itself and its contents (as if destroyed by a player). Plays the appropriate block breaking noise.
:* <code>keep</code> — Only [[Minecraft:air]] blocks are changed (non-air blocks are unchanged).
:* <code>keep</code> — Only [[Minecraft:air]] blocks are changed (non-air blocks are unchanged).
:* <code>replace</code> — The old block drops neither itself nor any contents. Plays no sound.
:* <code>replace</code> — The old block drops neither itself nor any contents. Plays no sound.
Line 41: Line 41:
{{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable|unparseable}}
{{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable|unparseable}}
{{Result table|The specified position is unloaded or out of the world.|fail|fail}}
{{Result table|The specified position is unloaded or out of the world.|fail|fail}}
{{Result table|Trying to place block in [[Minecraft:debug mode]].||N/A}}
{{Result table|Trying to place block in debug mode.||N/A}}
{{Result table|cmd=/setblock ... keep|Trying to change a non-air block.||fail}}
{{Result table|cmd=/setblock ... keep|Trying to change a non-air block.||fail}}
{{Result table|cmd=/setblock ... keep<br>/setblock ... replace<br>/setblock ... strict|Trying to replace a block with an identical copy (ignoring the block entity).}}
{{Result table|cmd=/setblock ... keep<br>/setblock ... replace<br>/setblock ... strict|Trying to replace a block with an identical copy (ignoring the block entity).}}
Line 72: Line 72:
|{{HistoryLine|java}}
|{{HistoryLine|java}}
|{{HistoryLine||1.7.2|dev=13w37a|Added {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.7.2|dev=13w37a|Added {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.11|dev=16w32a|Added [[Minecraft:block state]] support to {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.11|dev=16w32a|Added block state support to {{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|{{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 {{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.}}
Line 82: Line 82:
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|setblock|link=none}}.}}
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|setblock|link=none}}.}}
|{{HistoryLine|bedrock}}
|{{HistoryLine|bedrock}}
|{{HistoryLine||1.16.210|dev=beta 1.16.210.53|Added [[Minecraft:block state]] support to {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.16.210|dev=beta 1.16.210.53|Added block state support to {{cmd|setblock|link=none}}.}}
|{{HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>tileData: int</code> argument.}}
|{{HistoryLine||1.19.70|dev=Preview 1.19.70.21|Removed <code>tileData: int</code> argument.}}
}}
}}
Line 101: Line 101:
{{Navbox commands}}
{{Navbox commands}}


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

Revision as of 15:45, 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:Argument

Specifies the position of the block to be changed.
Template:Arg desc

Template:Argument

Specifies the new block.
Template:Arg desc

Template:El: Template:Argument

Specifies the block states to use for the block.
Template:Arg desc

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

Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table

Examples

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

References

<references/>

External links

Navigation

Template:Navbox commands

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