User:Aeldrion/CommandGuide/Basic commands

In this section, we will a few simple command examples to understand their syntax and we will learn how to use command blocks..

Basic commands
These commands can be executed from the chat. To indicate that you are running a command and not sending a chat message, commands must start with a slash.

Giving an item
The command can be used to give an item to players. Its syntax is as follows:

give [count]

Arguments between chevrons ( and  ) are required and arguments between square brackets are optional. This means that a command can be valid whether or not  is specified. However, a  command missing an   argument is invalid.

The  argument can be the name of a player or a "target selector" (I will go into further detail about target selectors in the next section). Now, you can use your own username or.

The  argument corresponds to an item ID. Item IDs are strings of text that define the item (eg.  or  ). Item IDs are sometimes inconsistent with the item name ( for a chain helmet, for example); you can however see what the ID of a specific item is by enabling advanced item tooltips (F3+H) and hovering over an item in the inventory, or by looking at the Minecraft wiki. Note that Bedrock Edition item IDs and Java Edition item IDs are sometimes not the same. The namespace allows mods to add their own item IDs without conflicting with vanilla items. It is optional but it is a good practice to specify it.

The  argument specifies the size of the stack of items you want to give. If this argument is not specified, it will default to 1, meaning that a single item will be given.

Here are examples of working  commands:

give @s minecraft:stick give Aeldrion minecraft:golden_apple 4 give @s diamond

Spawning a mob
The command allows to summon a specific type of mob. Similarly to the  command, the type of mob is specified by an ID (eg.  ). The namespace is still optional.

uses the following syntax:

summon  [position]

Right now, we will not use the  argument as we haven't seen coordinates yet.

As you may have noticed, when typing a command, a screen appears with suggestions for the next argument. You can use the tab key to autocomplete this argument and navigate through the list. This way, you can find any mob ID (or item ID) and see if an ID is invalid.

Here are examples of working  commands:

summon minecraft:llama summon minecraft:zombie_villager summon shulker

Displaying text in the chat
The command allows to display text in the chat. It is often used to verify if a command is working successfully while debugging as its syntax is very simple and the message can be seen by every player.

Its syntax is as follows:

say 

Unlike most arguments, the chat message in  can contain spaces.

Here are examples of working  commands:

say Hello world! say My name is Aeldrion say Why am I even bothering with these, it's impossible to have an invalid say command

Using command blocks
As we've seen in the previous section, command blocks are used to run a command automatically when receiving a redstone signal. Command blocks are not obtainable in the creative inventory. They can be however be obtained using a command:

give @s minecraft:command_block

Running a command
Once a command block is placed, you can right-click on it to access its UI. The top entry is where you can write the command that will be running. The second entry is the output: when the command runs, this entry will display the time it ran and what happened. If the command does not succeed, it will also appear in this entry.