Create Your First Addon Module
Extend AddonModule
Start by creating a new class that extends AddonModule. This class represents a single feature or content pack that your addon can load conditionally.
`java
public class MyCustomModule extends AddonModule {
@Override
public void onLoad() {
// Register your items, blocks, recipes, or other content here
}
}
`
Register in Your Module Provider
Create a class extending AddonModuleProvider and override the registerRawModules() method. Inside this method, call addRawModules() to register your module:
`java
public class MyAddonProvider extends AddonModuleProvider {
@Override
protected void registerRawModules() {
addRawModules(new MyCustomModule());
}
}
`
Call the Registration
Invoke AddonModuleRegis during your addon's initialization phase to register your provider with the mod system. Your module will now load automatically when the game starts, and only if all its dependencies are met.