How to Make a Command

Section

A command is one or more groups of characters that you can type in chat, beginning with a slash (/). Then, depending on the arguments, different actions will be executed.

How to make a command

  • Command name: This is the word to write to be able to use this command. This means the first word of this parameter will be what the player needs to write to execute the actions. This is also the first word that will be shown in the command list when using tab.
  • Permission level: By changing this parameter, you can define which group(s) of players can use and execute this command. "No requirement" will let everyone use and execute it. However, selecting 4 will restrict it to the highest operators of the world/server. You can learn more about permissions on this page of the Minecraft Wiki.
  • Command parameters: This Blockly let you edit the command itself, by making multiple branches of arguments and complex commands. Several parameters are provided with MCreator. However, the editor is also compatible with external plugins, meaning they can add new parameters. Read the next section to know more about parameters.

Command parameters

What is a parameter

A command parameter is every single data you can write. It can be as simple as a number, a boolean (logic) value or a single word String, but it can also be something such as a message, an item(stack), a block(state) or an entity selector. The name of a parameter is its name in the code, so you will need to use it when getting a parameter in procedures. This is also what will be shown above the chat's text inputt (where you write) to help players when they write the command.

How they work

It may seem hard to understand their utilization, but this is pretty visual. The command starts with the command entry point, which is the command's name. Then, every time you add a new parameter under another, it will create a new branch for parameters. For example, if you add a number parameter and then, a logic parameter (see image below), when typing the command, you will be able to write a number OR a logic value and not a number and then a logic value (/command number/logic).

1

However, if you take the same parameters, but you put the logic parameter inside the number parameter (see image below), then when you will write the command you will be able to provide a number and then a logic value (/command number logic).

2

To summarize, when you are outside a parameter, you create a new branch, but when you are inside a parameter block, you continue the branch. You can also create different branches at any level of the command like on the following picture.

3

On this picture, when the user writes a number, he will only be able to continue with a logic (/command number logic). However, if he starts with a block position (~ ~ ~), for the next parameter he will be able to select a number(/command position number) or a logic value (/command position logic).

Explanations of different parameters

Most of parameters are self-explanatory. However, there are some that might be a bit harder to understand.

  • Entity: This parameter allows you to use the entity selector (@a, @e, @p, etc.). However, it has multiple modes. The first one, one player, will only a value returning a single player (@p, @r, a name). The next one, players, will allow to return a list of one or multiple players. The last one, entities, is the most generic mode as it can return one or all entities, including players. However, when you will get the argument, in a procedure, you will need to use the statement when using players or entities, but the getter will be need for the one player mode.
  • Literal: This one is, in fact, pretty simple. This is a simple value that can its only purpose is to give a pre-defined choice usign its name as the value.
  • Message: This is the argument used by commands like the /ban, /kick, or /msg. It allows to use the rest of the command as a String. This means, when all previous parameters of its branch will be written, the command will allow the player to write everything desired, without restriction. However, no other argument can be added after it.
  • Accept any parameter: This is one is mostly for legacy purposes as this parameter will use the same logic as how commands worked before the implementation of the Blockly editor. In procedures, you will have to define the index number of ther desired parameter. However, this is the index of THIS Accept any parameter block only.

Video tutorial

If you prefer to watch the video, you can find the wiki page above summarized in a video:



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.