Skip to content

Commands Registry

The CommandsRegistryManager is a singleton class responsible for managing the registration of commands across different platforms.

package com.example.command;
public class MyCommand implements CoreCommand {
@Override
public void register(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext registry, Commands.CommandSelection context) {
// Implement the command registration logic here
}
}
package com.example.command;
public class MyRegistrationExample {
public static void register() {
// If your mod extends AbstractCommonMod, you can use your mod's instance to access the CommandsRegistryManager
MatthiesenCoreCommon.INSTANCE.getCommandsRegistryManager().registerCommand(new MyCommand());
}
}