Minecraft Modding For Kids For Dummies
Book image
Explore Book Buy On Amazon
A command block is a Minecraft in-game item that will execute certain commands. These blocks are typically available across multiplayer servers and custom servers, as they are only available in Minecraft worlds that have cheats enabled. As a result, players cannot use command blocks in Survival Mode.

Once you have a command block, you will be able to operate it to alter the existing world, change game settings, and even grant players experience points. Remember, command blocks are redstone mechanisms and need to be activated before being used.

List of command block commands

With a command block, you can apply basic commands in Minecraft with little trouble. Basic commands require only a few words and numbers. Once you understand the different types of commands you have at your disposal, you can modify the world anytime you see fit. The command blocks will support the following basic commands as seen in our list below.

Change game mode

defaultgamemode 
This command specifies the game mode for new players entering the world. For <mode>, you can enter survival, creative, adventure, or spectator, or the numbers 0, 1, 2, or 3, respectively.

Set game difficulty

difficulty 
This sets the difficulty level of the game. For <new difficulty>, you can enter peaceful, easy, normal, or hard, or the numbers 0, 1, 2, or 3, respectively. This strategy works even if the world’s difficulty is locked (preventing players without cheats from changing it), so keep this command block away from the wrong hands.

Change game mode for individual player

gamemode  
This command changes the game mode of the target player. For <mode>, you can enter survival, creative, adventure, or spectator, or the numbers 0, 1, 2, or 3, respectively.

Kill target

kill 
This command instantly kills whoever the target is. You can enter a username for <target> to kill a specific player’s avatar or use special arguments.

Third-person chat statement

me 
This displays a third-person statement in the chat. If you enter /me is building a house, the chat would say * Isometrus is building a house. The command block’s name is @ by default, making this command produce weird messages, such as * @ says hi. However, you can use the anvil block to rename the command block, allowing it to produce messages like * The Great Command Block says hi.

Say message

say 
This is just like the me command, except that it’s formatted more like a normal chat message. When activated, it prints [] .

Display seed

seed
This is the number from which the world is derived — in other words, two worlds with the same seed are created the same way. When this command is run from a command block, the seed of the world is outputted in the Previous Output box of the command block interface.

Private message

tell  
This command produces a message in chat that only certain players can see. The target receives the message whispers to you: . You can also use msg or w as alternatives to tell.

JSON message

tellraw  
This lets you send more intricate text messages to the target player(s). However, the message must be in JavaScript Object Notation (JSON) format, which can be complicated to use. Fortunately, websites, such as Ezekielelin.com, allow you to produce these messages with a buttons-and-menus interface.

minecraft command block example

Change time

time  
This allows you to change the time of day, represented by a number between 0 and 24000. This number constantly increases, but when it reaches 24000, it cycles back to 0 again because a full day and night have passed. This means that the daytime begins at 0 and nighttime begins at 12000. This command lets you manipulate this number.

The first parameter can be set or add, which determines whether you’re setting the time to a certain value or adding a number to its current position. is the number in question.

Display title

title   
This displays a large string of text in the middle of the target player’s screen. The text fades in, lingers, and then fades out. If the second parameter is title, the text is immediately displayed in this way. If the second parameter is subtitle, text is displayed as a subtitle under subsequent titles. The text itself is the final parameter, and it can be either simple text or in JSON format.

Display title with settings

title  times   
This is a different application for the earlier title command; it defines for the target player some individual settings that modify how titles are displayed. The last three parameters are all numbers representing how long the title should take to appear, how long it should stay, and how long it should take to disappear. The numbers are measured in ticks, or 20ths of a second.

Clear or reset title

title  
This is another application of the earlier title command. If the second parameter is clear, the title displayed to the target player is removed instantly. If the second parameter is reset, all of the player’s title settings (including subtitles) are returned to their defaults.

Stop / start rain

toggledownfall
This command toggles rain. If it’s raining, the rain stops — otherwise, it begins raining.

Change weather

weather  [duration in seconds]
This changes the weather. You can produce clear weather, rain, or a storm by setting the first parameter to clear, rain, or thunder, respectively. You can also include a number at the end of the command to specify the duration of the weather in seconds.

Grant xp

xp  
This command gives experience points to the target player; is the number of points given. However, you can also write a capital L at the end of this number to grant levels instead of points. For example, xp 100L Isometrus gives the player 100 extra experience levels.

About This Article

This article is from the book:

About the book authors:

Sarah Guthals, PhD, is a social software engineer, entrepreneur, and former engineering manager at GitHub. She is coauthor of Helping Kids with Coding For Dummies. Stephen Foster, PhD, is the CEO of ThoughtSTEM, a company that teaches computer science to kids across America. Lindsey Handley, PhD, is the COO of ThoughtSTEM and has hundreds of hours of experience as a classroom instructor for Minecraft-based science and computer science classes.

This article can be found in the category: