|Type of Block||Solid Block, Redstone|
|Tool Used||None (cannot be destroyed 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 invincible outside of creative mode. With Command blocks you can preform commands that players can not preform.
To get a command block using cheats, type
/give @p minecraft:command_block <amount>.
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 are 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.
|naturalRegeneration||Enables/disables regenerating health when hunger is full or close to full.|
|spectatorsGenerateChunks||Whether players in Spectator Mode can generate chunks.|
|showDeathMessages||Whether a message appears in the chat when a player dies|
|logAdminCommands||Whether to log admin commands to server logs|
|spawnRadius||The number of blocks outward from the world spawn coordinates that a player will spawn in when first joining a server or when dying without a spawnpoint|
|doDaylightCycle||Whether the day-night cycle and moon phases should progress|
|sendCommandFeedback||Whether the feedback from commands executed by a player should show up in chat.|
|reducedDebugInfo||Whether the Debug Screen shows all or reduced information|
|randomTickSpeed||How often a random block tick occurs (e.g. plant growth, leaf decay, etc.) per chunk section per game tick.|
Gamerules are case sensitive.
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).
An example of a gamerule command is
/gamerule mobGriefing true.
This table shows that commands can be restricted to players on the server.
An example of a command is:
/give @p minecraft:cobblestone 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
/tp @p[r=10] ~ ~10 ~
This command will teleport the nearest Player in a radius of 10 up 10 blocks.
- 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.
- Command blocks can hold an unlimited amount of text.
- If you name a command block in an anvil the name will appear when its ativated