NeoForge

NeoForge

magicutils-neoforge provides the platform adapter; magicutils-commands-neoforge adds the Brigadier command integration and the NeoForgeBootstrap helper.

NeoForgeBootstrap mirrors FabricBootstrap: give it the mod id and a supplier for the running MinecraftServer, then keep the runtime handle.

java
public final class MyMod {    private NeoForgeBootstrap.RuntimeResult magic;    public MyMod() {        magic = NeoForgeBootstrap.forMod("mymod", () -> currentServer())                .enableCommands()                .buildRuntime();        // Register commands when NeoForge fires the event.        NeoForge.EVENT_BUS.addListener(this::onRegisterCommands);    }    private void onRegisterCommands(RegisterCommandsEvent event) {        if (magic.commandRegistry() != null) {            magic.commandRegistry().registerCommand(event.getDispatcher(), new ExampleCommand());        }    }}

build() returns the legacy bootstrap view; buildRuntime() additionally gives you a managed MagicRuntime.

Bootstrap Options

NeoForgeBootstrap.Builder supports the same core options as the other platforms, plus the mod-specific opLevel:

MethodDescription
slf4j(logger)Bind an SLF4J logger for console output.
configDir(path)Override the config/lang data directory.
enableCommands()Create a CommandRegistry during bootstrap.
permissionPrefix(prefix)Set the permission node prefix for commands.
opLevel(int)Operator threshold used for permission fallbacks.
configureCommands(consumer)Register commands during bootstrap.
enableDiagnostics()Enable the diagnostics service.
configureDiagnostics(consumer)Register custom diagnostic checks.
initLanguage(boolean)Enable/disable language manager initialization.
bindLoggerLanguage(boolean)Bind the language manager to the logger.
setMessagesManager(boolean)Set the global Messages language manager.
registerMessages(boolean)Register the plugin's messages scope.
addMagicUtilsMessages(boolean)Register built-in MagicUtils messages.
bindClientLocaleSync(boolean)Follow each player's client locale.
translations(consumer)Configure additional translations.

Manual Wiring

When you want full control, wire the services yourself instead of using the bootstrap:

java
Platform platform = new NeoForgePlatformProvider();ConfigManager configManager = new ConfigManager(platform);LoggerCore logger = new LoggerCore(platform, configManager, this, "MyMod");CommandRegistry commands = CommandRegistry.create("mymod", "mymod", logger);// commands.registerCommand(dispatcher, new ExampleCommand()) on RegisterCommandsEvent

The second argument to CommandRegistry.create(...) is the permission prefix; an overload accepts an explicit operator level.

Notes

  • NeoForge uses LoggerCore directly instead of the Bukkit/Fabric Logger wrapper.