Minecraft Wiki
Advertisement
Dark Oak Sapling
This article is a stub. 
You can help by expanding it.

The Command Block is a block that was introduced in 12w32a and was officially released in Minecraft 1.4.2. It was introduced as a way to help support Adventure Mode, SMP automation, and custom maps.

To find out more in detail, visit the Command Block page.

Singleplayer applications (SSP)

Command blocks can be used in single player to change the difficulty, change the state of the weather, or give you predesignated items. They are particularly useful for the /downfall and /set time x commands, as they are only available in cheat mode otherwise. The /set time x command is especially useful, as it allows one to change the current time to a preset time at the press of a button.


Multiplayer applications (SMP)

This section details the applications of the Command Block in multiplayer.

  • Teleportation/Transport

Through /tp, one can create teleporters for public use on a server. Can be applied to a range of scenarios. For example, one could make a system of portals in a particularly large world in which all portals link to a central hub, which contains portals to all other portal locations creating a sort of "Fast Travel Hub"

  • Lottery

Through /give @r, one can create a lottery. Keep in mind that now, /give will directly put items into one's inventory, instead of throwing them on the ground in front of the character.

  • Jails

By rigging a clock to a command block and using /tp a whole bunch, you can force a player to stay at a certain place. If you do this it would be advisable to either turn off commands in your chat settings or do /gamerule commandBlockOutput false. Using the "Range" and "Minimum Range" parameters, you can have it teleport players back only when they're a certain distance away.

  • Admin Only

By using the parameter [m=1], only players in Creative will be affected by the command block. Hopefully only ops are in Creative on your server.

  • Announcements

By using /me in a command block one can create announcements that could play even when the admin/owner wasn't there.

  • Security Scan

By using /clear, you can scan people for items. If you want to remove certain items, use /clear @a(or <playername>) <itemid>. For example, on a server that doesn't want griefing you could have a clock connected to a command block set to /clear @a 259.

  • Race Referee

Using /say @p, the command block can report the nearest player. If the command block is placed after a finish line, it will say the finishers in order.

  • Creative Area/World Guard

Creating a "Creative Only" zone is possible through command blocks, but it is complex and more of a case-by-case basis. The basic idea would be to create a "fence" of command block affected zones so that, once a player flies in creative through it, they would be changed to survival or adventure mode. A "World Guard" zone would be a lot simpler, just have a command block do /gamemode @a [x y z r m] 2 and when people leave, just have a button to change them to survival.

  • Improving PvP without Plug-Ins

You can use /gamerule keepInventory true so players cannot steal each others items. Also, using /spawnpoint [x y z] and /tp [x y z] to help move players around while in PvP competitions.

  • Starter Kits

You can easily give people a starter kit with a button without plug-ins: "/give @p[r=2] 274". To prevent people pressing the button a second time and again getting their kit you can make two command blocks activated in order: 1. "/give @p[r=2 m=2] 274" 2."/gamemode @p[r=2] 0"

  • Special Colourful Words

Although you are not directly able to obtain colored/bold/italic text when typing into the Command Block GUI, through McEdit filters you can edit the text to have those properties just like how plug-ins change chat text properties on servers. SethBling's McEdit Filter: ColourCommandBlockText

  • Alarm System

When a player walks over a pressure plate, it can trigger a command block with /say @p

  • Remove Players

Using coordinate and maximum parameters you can teleport everyone within a specific area to another specific area.

  • Reward Room

If a certain player has been very nice,regular,or helpful to the sever but not quite meeting the requirements to be promoted to an admin, you could have a room full of buttons connected to Command Blocks with helpful effects, like giving the helpful player a stack of diamonds or a bedrock block, then have it connected to another command block, sending them to the spawn point. (It is VERY important this room is reinforced with bedrock, hidden, and you can only get in by teleporting to its co-ordinates to avoid abuse).

  • Weather Machine

(Command: /toggledownfall and /weather thunder (to start or stop a thunderstorm)) Assuming only admins can get to it, a weather machine can be quite useful, you can turn rain on and off at will. One of the more helpful uses of this technique would be to use a combination of villagers and some form of redstone machinery to create and automatic rain disabler, this would allow you to shut off the rain almost immediately without needing to use the command, or to have an admin present. It can also be used to create, and/or end, a scenario where it is more advantageous to have rain as opposed to sunlight, and vice versa; such as during a forest fire, or when a thunderstorm is spawning monsters.

Application in custom maps

This section details the applications of the Command Block in custom maps.

One map that takes advantage of a lot of the features of the Command Block is SethBling's TF2 Map "Dustbowl" in Minecraft. Video:[ http://www.youtube.com/watch?v=_f2brU8hBWc&feature=plcp] Another example is the Hypixel's Gladiator Arena in which the fighting system is almost only based on the Command Block.

Video:[ http://www.youtube.com/watch?v=jryJkWcqmzM]

  • Silent Command Block

It's important in a map to keep the command blocks silent, may it be to keep the magic of the suddenly appearing items in the inventory or because the channel telling that the player was teleported breaks the mood of a map. To keep them silent (except when you ask them to speak), just use the /gamerule commandBlockOutput false.

  • Safe Haven/Arena Fight Zone

Using pressure plates or tripwire, make areas (like a castle for instance) a different difficulty (for this instance I will use peaceful). the doors could have tripwire hooked to a command block that changes ones difficulty to peaceful, creating a sort of "Safe Haven". one could also do it the other way around, creating a more dangerous zone, such as arenas having the difficulty of hard, rather than normal or easy.

  • Detecting Cheaters

Using parameter [m=1] , you can affect those who are in Creative, or survival with parameter [m=0].

  • It's bigger on the inside

This is a simple one, just have a system of tp-ing command blocks at the entrance/exit of a place, and you can build the interior somewhere else, allowing you to cheat space restriction. (example of use: you want interior walls to be wool, but exterior walls to be wood (normally 2m thick walls). You can make the outside of the house be 8x10 m, and the inside of the house be 8x10 m.) Or, have the inside of the house 20x20m instead!

  • Save game

By using the "/spawnpoint" command, one can easily make a button-activated checkpoint.

  • Lava parkours

As said before, there is a command that makes the player able to keep his inventory upon death: /gamerule keepInventory true. Simply connect this to a pressure pad before a parkour level over lava and you don't have to use any kind of chest minecart (especially useful when the player has it's full inventory, which is bigger than a single chest).

  • Still want a bed?

It is true that the /spawnpoint command is really useful because you don't have to wait for the night to create a checkpoint, but what if you want to have a BUD switch connected to the bed or something of the sort? Then, you just need to have a pressure plate (it's more discreet) connected to a block with the /time set 18000 command, and it will set the time to night so the player can sleep.

  • Time and weather following the scenario

Let's say your map starts on a cold stormy night and when the player starts, for some random reason, there's a bright sun outside! Or what if you want to start on a bright day and the rain decides to join along? Fear not, for there is a weather command. Just use the /weather input command with, as input, clear, rain or thunder. Along with this, you can also use /time set input with as input a number: 0 is sunrise, 6000 is noon, 12000 is dusk and 18000 is midnight.

  • Talking Adventure Map(featuring an easy Quest System!)

The /say command is really useful because it makes a text appear into the chat. It's maybe one of the greatest use of the Command Block as you don't need signs or book to show the game rules. Just put a bunch of them in lines with repeaters set to two or three ticks (so the player isn't spammed) and you can easily remove a chest or a lot of signs.

Another use of the command is talking NPCs. Imagine you enter a butchery and you want the butcher to say something. Before, you needed to use signs or books, using some room in a butchery and putting objects that sometimes seemed random, but now... You just have to use the /say command and the butcher will talk. Let's take another example: you are in a factory and an alarm suddenly rings and says that it's going to explode. Having it in the chat, especially if the text is long, keeps the stressing mood; the same thing works for bomb timers. The player will get more into the map's mood if the chat displays '10...' '9...' '8...' aso.

Last but not least, it makes it easier to create a Quest System. Let's say the player gets in a butchery. He activates through a pressure plate a command block with the /say command in which the butcher asks for the player's help: he need to kill a pig. The player gets to the pig that is standing on a stone pressure plate, that turns off when the pig is dead. So, when the player gets back to the butchery, he activates another circuit containing two command blocks with two commands. First, the /say command in which the butcher thanks the player, and other one, the /give command, so the player gets the reward. Along with that, don't forget to use the @p command so the butcher says the player's name. For example, if the command block is set to do this: /say Thanks, @p. You helped me a lot killing that pig, the channel will say: "@]: Thanks, <name of the player>. You helped me a lot killing that pig." This makes the map way cooler and looks like it's made for the player as it says his/her name!

See also

Advertisement