FANDOM


For the repeating version of this block, see Repeating Command Block.

The Command Block is a redstone-powered block that was made available in 1.4.2 - The Pretty Scary Update. The command block will perform server commands when attached to a redstone circuit. This block can't be crafted, and only server operators are allowed to place and use 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 "operator" abilities. Command blocks are invincible outside of creative mode just like bedrocks. With command blocks, one can perform commands that players can't perform.

To get a command block using cheats, type /give @s minecraft:command_block <amount>/give @p minecraft:command_block <amount> or /give <username> minecraft:command_block <amount>.

Behavior

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. For more information, see the commands article (linked above). An example of a command is /give @p minecraft:cobblestone 64 This command will give the nearest player a stack of cobblestone. Note, you don't have to put a slash in the front if using a command block.

Command blocks can also be used on other entities as of release 1.8. They are the 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 will teleport all entities to the coordinates X=10, Y=64, and Z=255.

One may also check for a specific quality of a player or entity, /execute at @p[distance=..10] run tp ~ ~10 ~, This command will teleport the nearest player in a radius of 10 up 10 blocks.

Trivia

  • One can spawn mobs that are in the game but can't be spawned naturally. For example, /summon giant ~2 ~ ~ will summon a giant zombie 2 blocks away from the command block.
  • This is one of the only blocks that you need a code to get the block and the other one is allow.
  • If one sets the command to /execute if block x y z #minecraft:doors[open=true], where x, y, and z are the coordinates of the bottom half of a door, #minecraft:doors is a block category for the doors and [open=true] is the NBT in which when the door open, by placing a comparator facing away from the command block, one can test if a door is open or shut.
  • Command blocks can hold up to about 32,500 characters.
  • In Bedrock Edition, if one names a command block in the configurator, the name will appear either above the block when one has pointed or the block's output message.

Gallery

CommandBlockNew

Click for full Command Block gallery.

Community content is available under CC-BY-SA unless otherwise noted.