|Type of Block||Solid Block, Redstone|
|Tool Used||None (cannot be destroyed outside of Creative Mode)|
|Data Values||Hex: 89|
The Command Block is a redstone-powered block that was made available in the 1.4 update for Minecraft. The Command Block will perform server Commands when attached to a redstone circuit. This block cannot 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 "staff" abilities. Command blocks are invincible outside of creative mode. With Command blocks, you can perform commands that players can not perform.
To get a command block using cheats, type
/give @p minecraft:command_block <amount>.
When attached to a redstone circuit, the Command Block can perform a variety of server commands, such as changing the difficulty or giving players items. For more information, see the commands article (linked above). An example of a command is:
/give @p minecraft:cobblestone 64
This command will give the nearest player a stack of Cobblestone.
Command Blocks can also be used on other entities as of release 1.8, not 1.7. Watch the snapshot videos. They are the 1.8 ones that talk about 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
This command will teleport all entities to the coordinates X=10, Y=64, Z=255
/tp @p[r=10] ~ ~10 ~
This command will teleport the nearest Player in a radius of 10 up 10 blocks.
- You can spawn in a command block with cheats enabled by typing "/give (player name) 137" or /give (player name) "minecraft:command_block".
- You can spawn mobs that are in the game, but cannot be spawned naturally. For Example, /summon Giant ~2 ~ ~ will summon a Giant Zombie 2 blocks away from the command block.
- If you set the command to /testforblock x y z a open, where x, y, and z are the coordinates of the bottom half of a door, and a is the blocked for the door, by placing a comparator facing away from the command block, you can test if a door is open or shut.
- Command blocks can hold an unlimited amount of text.
- If you name a command block in an anvil, the name will appear when it's activated.