Client Commands


Client Commands is a utility/library mod for other mods to use.
It reintroduces client side only commands to Minecraft (Forge).
This mod doesn't add anything on its own.

The prefix for client side commands is !


How to for Modders:
Commands can be registered 2 way, either by sending your commands over with the IMC system,
or by requesting to get the CommandDispatcher over IMC.
The latter is easier to use if you've got multiple commands.

You can just create your commands the same way as you would for normal Commands.
However, both the world and server of the CommandSource will be null!
Here's an example of the IMC system, the event is registered on the Mod Bus:

private static void enqueueIMC(InterModEnqueueEvent event){
    //Registering single commands expects a 'LiteralArgumentBuilder<?>'
    InterModComms.sendTo("clientcommands", "register_command", () -> /* command instance */);

    //Registering commands using a callback expects a 'Consumer<CommandDispatcher<CommandSource>>'
    InterModComms.sendTo("clientcommands", "register_commands", () -> this::registerCommands);



private static void registerCommands(CommandDispatcher<CommandSource> commandDispatcher){
    //register your commands to the dispatcher


Feedback as well as Questions can be posted in our Discord

The Discord Logo with a Join Us banner right next to it