Minecraft /setblock Command
Changes a single block at specified coordinates to a new block type, with optional block state properties and replacement modes.
バージョン対応
コマンド構文
/setblock <pos> <block>[<states>] [destroy|keep|replace]/setblock <position> <tileName> [tileData|blockStates] [replace|destroy|keep]引数の解説
pos / positionCoordinates必須Coordinates of the target block (absolute X Y Z or relative ~ ~ ~).
block / tileNameNamespaced Block ID必須Block identifier to place (e.g. minecraft:redstone_block, air, oak_door).
modePlacement Modereplace (default, overwrites silently), keep (only places if target is air), destroy (breaks existing block with particles and drops).
states / tileDataBlock States / IntegerJava square-bracket states (e.g. [facing=north,lit=true]) or Bedrock tileData integer/states.
実用的な使用例
/setblock ~ ~-1 ~ minecraft:redstone_block replacePlaces a redstone block beneath your feet to activate redstone mechanisms.
Activating hidden redstone circuits.
/setblock 100 64 -200 minecraft:chest[facing=south]{Items:[{Slot:0b,id:"minecraft:diamond",count:3}]} replaceJava: Places a chest facing South containing 3 diamonds in the first slot.
Procedural treasure chest generation.
/setblock ~ ~1 ~ minecraft:campfire[lit=true] keepPlaces a lit campfire above you only if the block above is currently empty air.
Safe camp setup.
/setblock ~ ~-1 ~ minecraft:air destroyBreaks the block beneath you with block break particles and drops the item.
Pitfall trap activation.
よくあるミス
ミス:
Using keep mode on a non-air block, causing the command to fail silently
修正方法:
Use "replace" mode if you want to overwrite existing blocks regardless of what is there.
ミス:
Using destroy mode on container blocks, scattering items everywhere and causing lag
修正方法:
Use "replace" mode with air: /setblock ~ ~ ~ air replace
ミス:
Placing directional blocks (doors, pistons, stairs) without specifying facing states
修正方法:
Include the facing state: /setblock ~ ~ ~ minecraft:piston[facing=up]
Java版と統合版の違い
Java Edition allows attaching block entity NBT in curly braces (like chest inventories or custom sign text). Bedrock does not support NBT inside /setblock, requiring Structure Blocks or behavior packs for container data.
Command Block Usage & Automation
Widely used as a "wireless redstone" transmitter. A command block at location A runs "/setblock 50 64 50 minecraft:redstone_block" to instantly power redstone wire at location B across any distance in loaded chunks, and another block later removes it with "/setblock 50 64 50 minecraft:air".
便利なヒント
In Java Edition, check the F3 debug screen target block info to inspect all valid block states before writing commands.
Placing water or lava with /setblock places a source block instantly without fluid physics updates if tick freeze is on.
重要な注意事項
Unlike /fill, /setblock targets exactly one block. In Java Edition, you can attach block entity NBT in curly braces (like chest inventories, banner patterns, or sign text) directly to the command.
よくある質問
Can I place chests with loot inside using /setblock?
Yes in Java Edition by appending NBT: /setblock ~ ~ ~ chest{LootTable:"minecraft:chests/simple_dungeon"}
How is /setblock different from /fill?
/setblock only alters one block coordinate, whereas /fill operates on 3D cuboids between two corners.