Commands: The Basics

Commands: The basics
Please note that the contents of this page will not work for Java Edition, Playstation 4 Edition, or Xbox 360 Edition.
There are five basic selectors when it comes to commands: @a, @e, @p, @r, and @s. The command menu will indicate when and where this needs to be inserted in your command while you're typing it in.
When @a is used in a command, the command targets all players in the world. For example, /kill @a will kill everyone in the game.
@e targets all entities, so not just players, but mobs too, as well as other things Mojang classifies as entities (for example, armor stands, dropped items, and paintings). /kill @e would kill all entities in the game.
@p targets the closest player, so if you type a command into chat using @p, then you will most likely be affected, as you are "closest" to yourself. Thus, when typing in commands, @p is almost equivalent to @s (yourself), but it can be used for different purposes when using command blocks.
@r targets a random player, so when typing in /kill @r, a random player will die.
@s, as mentioned earlier, refers to oneself, the person typing in the command. Unfortunately, this cannot be used in command blocks.
If you want to get slightly more advanced, you can add modifiers onto the end of selectors. Typing in "/kill @e[type=zombie]" (just like that) will kill all zombies and nothing more.

Many commands involve coordinates. There are three coordinate values in Minecraft, referred to as X, Y, and Z, always in that order (except when one of them is left out, as Y is in the /spreadplayers command). X is to one side, Y is the vertical plane, and Z is to the other side. A set of coordinates looks like this:
58 34 -762
The maximum build height has a Y value of 256, sea level is 64, and the lowest layer of bedrock is 1. The optimal layer to find diamonds is said to be Y = 15.
When using coordinates in commands, any of the coordinates can be substituted for with a tilde (~). This indicates the current coordinates of the player or command block executing the command. So if a player types in "/summon creeper ~ ~ ~," then a creeper will appear at the exact coordinates at which the player is located.

No comments:

Post a Comment