|First Appearance||Java Edition: 1.4.2 12w32a|
Pocket Edition: 1.0.5 alpha 184.108.40.206
|Type of Block||Solid Block, Redstone|
|No parameters specified|
The Command Block is a redstone-powered block that was made available in 1.4.2 - The Pretty Scary Update. The command block will perform server commands when attached to a redstone circuit. This block can't be crafted, and only server operators are allowed to place and use them. Command blocks can only be obtained when cheats are activated, and can still only be used in creative mode, preventing survival players in a server from accessing "operator" abilities. Command blocks are invincible outside of creative mode just like bedrocks. With command blocks, one can perform commands that normal players can't perform.
To get a command block using cheats, type
/give @s minecraft:command_block <amount>,
/give @p minecraft:command_block <amount> or
/give <username> minecraft:command_block <amount>.
Behavior[edit | edit source]
When attached to a Redstone circuit, the command block can perform most server commands, such as changing the difficulty or giving players items. For more information, see the commands article (linked above). An example of such a command is
/give @p minecraft:cobblestone 64 This command will give the nearest player a stack of cobblestone. (Note: You don't have to put a slash in the beginning when using a command block.)
Command blocks can also be used on other entities as of update 1.8. All entities get affected by the @e selector, using the shorthand @e. This can be used to create custom spawners, and therefore is a very useful tool for mapmakers. Here is an example:
/tp @e 10 64 255 will teleport all entities to the coordinates X=10, Y=64, Z=255.
One may also check for a specific quality of a player or entity,
/execute at @p[distance=..10] run tp ~ ~10 ~, This command will teleport the nearest player in a radius of 10 up 10 blocks. That command can also be written as
/tp @p[distance=..10] ~ ~10 ~
Trivia[edit | edit source]
- One can spawn mobs that are in the game but can't be spawned naturally. For example,
/summon giant ~2 ~ ~will summon a giant zombie 2 blocks away from the command block.
- This is one of the only blocks that you need a code to get the block and the other one is allow.
- If one sets the command to
/execute if block x y z #minecraft:doors[open=true], where
zare the coordinates of the bottom half of a door,
#minecraft:doorsis a block category for the doors and
[open=true]is the NBT in which when the door open, by placing a comparator facing away from the command block, one can test if a door is open or shut.
- Command blocks can hold up to about 32,500 characters.
- In Bedrock Edition, if one names a command block in the configurator, the name will appear either above the block when one has pointed or the block's output message.