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]
자바 vs 베드락 차이점
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.