Content Guides

Commands

Registering Commands

Commands can be registered using Balm.commands().register(...), which gives you access to Minecraft's Brigadier CommandDispatcher.

public class ModCommands {

    public static void initialize(BalmCommands commands) {
        commands.register(ModCommands::register);
    }

    private static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
        dispatcher.register(Commands.literal("yourmod")
            .then(Commands.literal("ping")
                .executes(context -> {
                    context.getSource().sendSuccess(() -> Component.literal("Pong"), false);
                    return 1;
                }))
        );
    }

}

For more information on how to use Brigadier, your best option is to look at Vanilla commands similar to yours and see how they are registered.