Mod implementation
Your mod must contain exactly one class implementing the IMod interface (from Mafi.Core.Mods).
For mods that only add content (machines, recipes, research, etc.) without custom services, use the DataOnlyMod base class:
public sealed class ExampleMod : DataOnlyMod {
public ExampleMod(ModManifest manifest) : base(manifest) {
Log.Info("ExampleMod: constructed");
}
public override void RegisterPrototypes(ProtoRegistrator registrator) {
registrator.RegisterAllProducts();
registrator.RegisterData<ExampleMachineData>();
registrator.RegisterDataWithInterface<IResearchNodesData>();
}
public override void MigrateJsonConfig(VersionSlim savedVersion, Dict<string, object> savedValues) {
}
}
For mods that need to register custom dependencies or perform initialization, implement IMod directly.
The lifecycle methods are called in this order:
RegisterPrototypes()- register all game content (machines, recipes, etc.)RegisterDependencies()- register custom services with the DI containerEarlyInit()- early initialization before map generationInitialize()- final initialization before game starts