How To Use Minecraft Command Blocks

This humble minecraft command block awaits your commands.

The command block is a minecraft block designed to be used in Adventure Mode. With a command block a map creator will be able to ‘instruct’ a map/block to dispense specific items and EXP points when the block is activated via a redstone current. This means that when a player completes an objective in adventure mode, they can be rewarded. The command block can also be used to change how the game behaves at different stages of the map. Mob spawning, fire spread, block and mob drops can all be controlled via the command block. The command block can also be used in multiplayer server maps (SMP).

Specific information on how to make the minecraft command block work after the jump!

To use the command block, one simply right clicks on the block. The command GUI then opens.

You can instruct the command block to perform actions by using the same sort of commands that have always been used in Minecraft SMP, in other words /give @p 1 1.

This command would give the player a single piece of smoothstone. The @p is part of a new notation that allows the command block to reward a single player, all players on the server or map and other combinations without needing to have player specific names coded into the block.

Here’s a quick guide to the new player notations:

@p = player
@a = all players
@r = random player
@f = player farthest away

Command Blocks can also be used with the new /gamerule command. The /gamerule command changes the rules of the game. It can be used to turn fire spread on and off, to change whether or not mobs spawn, blocks drop, whether a player can keep their inventory after death and others.

A quick guide to minecraft /gamerule commands:

commandBlockOutput – Changes whether or not the command block outputs text to the console, ie, whether the player will be notified as to changes of game rules or not.
doFireTick – Turns fire spread on or off.
doMobLoot – Turns mob drops on or off.
doMobSpawning – Turns mob spawning on or off.
doTileDrops – Turns block drops off (ie, if you break a block, it will or will not drop and be able to be picked up.)
keepInventory – Decides whether a player can keep their inventory after death.
mobGriefing – Turns the ability of mobs to destroy blocks through creeper explosions or endermen grazing.