Changes

Jump to navigation Jump to search
→‎Mod registry: + SMAPI 2.8 changes
Line 19: Line 19:  
foreach(IManifest manifest in this.Helper.ModRegistry.GetAll()) { … }
 
foreach(IManifest manifest in this.Helper.ModRegistry.GetAll()) { … }
 
</source>
 
</source>
 +
 +
{{SMAPI upcoming|2.8|content=In SMAPI 2.8, the methods return <tt>IModInfo</tt> instead of <tt>IManifest</tt>:
 +
<source lang="c#">
 +
// check if a mod is loaded
 +
bool isLoaded = this.Helper.ModRegistry.IsLoaded("UniqueModID");
 +
 +
// get info for a mod
 +
IModInfo mod = this.Helper.ModRegistry.Get("UniqueModID");
 +
bool isContentPack = mod.IsContentPack;
 +
IManifest manifest = mod.Manifest; // name, description, version, etc
 +
 +
// get info for all loaded mods
 +
foreach(IModInfo mod in this.Helper.ModRegistry.GetAll()) { … }
 +
</source>
 +
}}
    
==Mod-provided APIs==
 
==Mod-provided APIs==
translators
8,403

edits

Navigation menu