Command Block

The Command Block is a block made with the intent to support Adventure mode and allows mapmakers to expand the interaction with the player through server commands. The block can run specified server commands when activated by a redstone current. Considering its great power and possibilities, it can't be normally crafted. Currently, it is not available in the creative mode inventory either. Only players with sufficient privileges to use the 'give' command:   can obtain the block. Furthermore, only players which are in the Creative mode and are also an Operator on the server are able to edit and successfully save the command of the block. To be able to use this block in Multiplayer, you have to set the value of  to   in the server.properties file. 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. They can't be pushed by pistons, as they have tile entities. The maximum command length is limited to 254 characters.

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 version 12w32a a new  command has been added.

Usage:

Disabled commands
The following commands have been disabled for use with the Command Block.


 * However, the  command still works and allows broadcasting of server-wide messages. The Command block itself is then represented by the "at sign" . Additionally, it's worth noting that the " " command normally needs a player context to work, but it works flawlessly with the Command block nonetheless.

Arguments
After using a target you can optionally use arguments. This is how you use the arguments:

Example:

Alternatively, the coordinates and maximum (but not minimum!) radius can be provided more concisely as long as they're the first (up to four) arguments without keys, for instance:

is identical to the previous example.

Because the argument 'c' uses players from the end of a list first when negative,  may be used to select the farthest player instead of the nearest one.

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

 * When the gamerule command commandBlockOutput is false it will still say when a gamerule is updated. [verified]
 * The /give command does not function at all with the [x=#,y=#,z=#] arguments although /tell works fine(not tested with all commands). It will work with [x=#,y=#,z=#,r=#]

Examples

 * 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 user 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