|Type of Block||Solid Block, Redstone|
|Tool Used||None (impervious to destruction outside of Creative Mode)|
|Data Values||Hex: 89|
The Command Block is a redstone-powered block that was made available in the 1.4 patch for Minecraft. The Command Block will perform server commands when attached to a redstone circuit. This block cannot be crafted and only server administrators are allowed to place 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 invincincible outside of creative mode, but were previously destroyed in a single touch of a survival player before 1.5.With Command blocks you can preform commands that players can not preform.
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. There are also gamerules, which do unique commands.
This table shows the list of gamerules.
|Gamerule||What it does|
|commandBlockOutput||Enables/disables text output of command block commands to console|
|Enables/disables fire spread.|
|doMobLoot||Enables/disables mob drops.|
|doMobSpawning||Enables/disables the spawning of mobs unless you want them to ex: eggs and mob spawners will still spawn mobs.|
|doTileDrops||Enables/disables blocks dropping items when broken (includes TNT destroying blocks).|
|keepInventory||Enables/disables keeping inventory on death.|
Enables/disables creepers, ghasts, and Wither blowing up blocks, endermen picking up blocks and zombies breaking doors.
|doNaturalRegeneration||Enables/disables regenerating health when hunger is full or close to full.|
Gamerules are case sensitive.
An example of a gamerule is /gamerule mobGriefing true You must type in /gamerule before the name of the actual gamerule. true/false tells whether you want to disable the gamerule (false), or enable it (true).
This table shows that commands can be restricted to players on the server.
An example of a command is:
/give @p 4 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
this command will teleport all entities to the coordinates X=10, Y=64, Z=255
- You can spawn in a command block with cheats enabled by typing "/give (player name) 137" or /give (player name) "minecraft:command_block".
- You 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 you set 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 blockid for the door, by placing a comparator facing away from the command block, you can test if a door is open or shut.
<gallery captionalign="left"> Command Block Circuit.png|A Command Block attached to a redstone circuit. Command Block Output.png|Items given to a player from a Command Block. Command Block GUI.png|The interface for a Command Block where the server command can be tested.