I need to know how to create a command with optional arguments

Started by Tiwo68_ on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I need to know how to create a command with optional arguments
Thu, 01/15/2026 - 21:59 (edited)

Hello,  i need to know how to create a command with optional arguments using /charged-creeper [pos] [IsIgnited] [FuseDelay]

[IsIgnited] is bool

I got "build failed" when I try to compile it

 

Edited by Tiwo68_ on Thu, 01/15/2026 - 21:59
Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
(No subject)
Thu, 01/15/2026 - 21:57

Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hello,  i need to know how…
Thu, 01/15/2026 - 21:58

Hello,  i need to know how to create a command with optional arguments using /charged-creeper [pos] [IsIgnited] [FuseDelay]

[IsIgnited] is bool

i tried ChatGPT but not worked :(

Joined Aug 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you want to create a…
Sat, 01/17/2026 - 00:55

If you want to create a multi branches command (so a command with optional parameters), you first need to add blocks for all the arguments your command can have. If your command arguments' definition doesn't contain an argument, you won't be able to use it inside your procedure (as it won't exist for the game). After you completed adding all your arguments (in your case, you simply need to put each argument inside the previous one), this is where you make your arguments optional or not. To make an argument option, simply create a new procedure and call it with the "Call procedure" block under and argument.

 

For example, for your command, you will have to use a block position parameter block. Inside this block, you need to use the logic parameter block that will contain a number parameter block. To execute the command when all arguments are filled by the user, you place a call procedure inside the number parameter block. However, if, for example, you want the last argument option, you simply need to create a new procedure that doesn't call get the value of the last argument, and you call it outside the number parameter block (so you can place it under or above it). To make the isDelay parameter optional, do the same thign as for the oprevious one, but you place the call procedure under the isDelay logic parameter block.

 

You should read the wiki page next time as everything is very well explained :) https://mcreator.net/wiki/making-command

Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you !
Fri, 01/30/2026 - 10:58

Thank you !