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 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 just like bedrocks. With command blocks, one can perform commands that players can not perform.
To get a command block using cheats, type
/give @s minecraft:command_block amount> or
/give <username> 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 will teleport all entities to the coordinates X=10, Y=64, and Z=255.
- One can spawn in a command block with cheats enabled by typing
/give (player name) minecraft:command_block.
- One 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 one sets 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, one can test if a door is open or shut.
- Command blocks can hold up to about 32,500 characters.
- If one names a command block in an anvil, the name will appear when it's activated.