Changes

Jump to navigation Jump to search
+ mod registry from Modding:Modder Guide/APIs (only author is Pathoschild)
Line 1: Line 1:  
{{../../header}}
 
{{../../header}}
   −
A ''mod integration'' refers to two mods communicating or cooperating in some way. SMAPI provides two distinct features to support this.
+
A ''mod integration'' refers to two mods communicating or cooperating in some way. SMAPI provides three distinct features to support this.
    
==Dependencies==
 
==Dependencies==
 
You can define dependencies in your <tt>manifest.json</tt> file. These are other mods which are required to use this mod. SMAPI will load those mods first, and show a friendly message to the player if some dependencies are missing. See [[../Manifest|the manifest page]] for more info.
 
You can define dependencies in your <tt>manifest.json</tt> file. These are other mods which are required to use this mod. SMAPI will load those mods first, and show a friendly message to the player if some dependencies are missing. See [[../Manifest|the manifest page]] for more info.
 +
 +
==Mod registry==
 +
Your mod can get information about loaded mods, or check if a particular mod is loaded. (All mods are loaded by the time your mod's <tt>Entry(…)</tt> method is called.)
 +
 +
<source lang="c#">
 +
// check if a mod is loaded
 +
bool isLoaded = this.Helper.ModRegistry.IsLoaded("UniqueModID");
 +
 +
// get manifest info for a mod (name, description, version, etc.)
 +
IManifest manifest = this.Helper.ModRegistry.Get("UniqueModID");
 +
 +
// get manifest info for all loaded mods
 +
foreach(IManifest manifest in this.Helper.ModRegistry.GetAll()) { … }
 +
</source>
    
==Mod-provided APIs==
 
==Mod-provided APIs==
translators
8,403

edits

Navigation menu