Command Block

The Command Block is a block made with the intent to support Adventure mode and will allow mapmakers to expand the interaction with the player through server commands. The block can run specified server commands when activated by redstone current. Considering its functionality, they will not be able to be crafted and only administrators will be able to place and edit them when they are in creative. Currently, it is not available in the creative mode inventory. You can use the 'give' command:  to spawn the command block entity to a certain player. To be able to use this block in multiplayer, you must replace  by   on line   in server.properties. If this line doesn't exist, you'll have to add it. When you are in survival, you can break the command block with a single click, but it doesn't drop anything.

Usage
The Command Block will execute server commands like giving items or experience to a player.

To change the command executed by the block, simply right-click it, and a GUI will open.

In place of player names, it is possible to use multiple different shorthands:

When using commands, treat them as if entered from the console - you always need to specify the target, so it is not possible to use commands such as "kill" which do not take a player argument. For example, to change the mode to Survival for the nearest player type:. Note that you will have to be in Creative mode to change the command associated with the block.

Gamerules
As of Minecraft version 12w32a a new command, gamerule, has been added for custom maps that use the command block.

Usage: /gamerule

Disabled commands
As of 12w32b, these commands have been disabled for the Command Block.


 * However "/me" command still works and allows to broadcast messages server-wide. Command block identifies itself as "@". Worth noting is the fact that "/me" command, is an example of command without player target that actually works with Command block.

Arguments
After using a target (@a) you can optionally use arguments. This is how you use the arguments: @ [ =, = ]

Example: @p[x=1,y=30,z=26,r=10,rm=2,m=1,c=3,l=25,lm=3]

History
On July 27th, 2012, Jeb began tweeting of a new block he had created to start expanding Adventure mode. He began posting pictures, ideas and hints of what the block will be able to do. During Notch's AMA he hinted the block may be in 1.4.

Bugs

 * Even if doFireTick command is set to false, lava and lightning will still start fires on nearby blocks, but they won't spread or destroy flammable blocks.
 * @f is not in the list of @´s.
 * When the gamerule command commandBlockOutput is true it will still say when a gamerule is updated.

Trivia

 * It is possible to make teleporters using the command block. (e.g. code: )
 * Commands using coordinates (eg. "/tp" or "/spawnpoint") add 0.5 to integers, like usual. To clarify, the number -33 would be interpreted as -32.5, and the number 187 would be interpreted as 187.5.
 * The player can make a kind of world guard using the command block. (e.g. code: )
 * The commandBlockOutput gamerule does not affect the command block using the and  commands.
 * The commands  and   will cause the command block to say use name of the nearest player in the message, however   just causes it to say "Hello, @p".

Usage of the Command Block
Page detailing innovative, practical uses of the Command Block Tutorials/Command Block