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 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. When you break a command block with a pickaxe, it will drop. 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 variables:

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.

The command block sends commands through the console in singleplayer and multiplayer, though commands can still be prefixed with a "/". If you want to give the nearest player stone, you can enter  or.

For innovative, practical uses of the Command Block, view Tutorials/Command Block.

Examples

 * It is possible to make teleporters using the command block. (e.g. code: )
 * If you use the teleport command with the command block, you can use relative coordinates in the destination coordinates by placing an '~' in front of a Coordinate (e.g. code:  This would teleport the player 8 blocks into the air).
 * 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, 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".

Game Rules
Game Rules allow players and command blocks to adjust several base settings.

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 "@" symbol (in 13w04a or later the command block will use block's name. Additionally, it's worth noting that the " " command normally needs a player context to work, but it works flawlessly with the command block (as well as the server console itself) regardless.

Arguments
After using a target (,  or  ) you can optionally use arguments. This is how you use the arguments: NOTE: Make sure you do NOT add a space between arguments or commas.

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.