Skip to content

Custom Commands (Minecraft)

Description

Create custom commands, either generally or specifically for the client.

Identifier

Refer to this via any of the following:

groovy
command/* Used as page default */
Command
minecraft.command
minecraft.Command
Minecraft.command
Minecraft.Command
vanilla.command
vanilla.Command
Vanilla.command
Vanilla.Command
mods.mc.command
mods.mc.Command
mods.vanilla.command
mods.vanilla.Command
mods.minecraft.command
mods.minecraft.Command

Adding Entries

  • Registers the given command to the client:

    groovy
    command.registerClientCommand(ICommand)
  • Registers the given command to the client in the format name, command, with command being a Closure taking 3 parameters, MinecraftServer server, ICommandSender sender, and String... args:

    groovy
    command.registerClientCommand(String, SimpleCommand.ICommand)
  • Registers the given command to the client in the format name, usage, command, with command being a Closure taking 3 parameters, MinecraftServer server, ICommandSender sender, and String... args:

    groovy
    command.registerClientCommand(String, String, SimpleCommand.ICommand)
  • Registers the given command to the given command handler, in the format handler, command:

    groovy
    command.registerCommand(CommandHandler, ICommand)
  • Registers the given command:

    groovy
    command.registerCommand(ICommand)
  • Registers the given command in the format name, command, with command being a Closure taking 3 parameters, MinecraftServer server, ICommandSender sender, and String... args:

    groovy
    command.registerCommand(String, SimpleCommand.ICommand)
  • Registers the given command in the format name, usage, command, with command being a Closure taking 3 parameters, MinecraftServer server, ICommandSender sender, and String... args:

    groovy
    command.registerCommand(String, String, SimpleCommand.ICommand)
Example
groovy
command.registerCommand('groovy_test', { server, sender, args -> sender.sendMessage('Hello from GroovyScript')})

Contributors

© 2024 CleanroomMC. All Rights Reserved.