Line 1: |
Line 1: |
| {{../../header}} | | {{../../header}} |
| | | |
− | Every SMAPI mod or content pack must have a <tt>manifest.json</tt> file in its folder. SMAPI uses this to identify and load the mod, perform update checks, etc. The manifest info is also available to any mod in code (using <tt>this.ModManifest</tt> for the current mod's manifest, or [[../#Mod registry|mod registry]] for other mods' manifests). | + | Every SMAPI mod or content pack must have a <samp>manifest.json</samp> file in its folder. SMAPI uses this to identify and load the mod, perform update checks, etc. The manifest info is also available to any mod in code (using <samp>this.ModManifest</samp> for the current mod's manifest, or [[../#Mod registry|mod registry]] for other mods' manifests). |
| | | |
| ==Basic examples== | | ==Basic examples== |
Line 45: |
Line 45: |
| ! description | | ! description |
| |- | | |- |
− | | <tt>Name</tt> | + | | <samp>Name</samp> |
| | The mod name. SMAPI uses this in player messages, logs, and errors. Example: <syntaxhighlight lang="javascript">"Name": "Lookup Anything"</syntaxhighlight> | | | The mod name. SMAPI uses this in player messages, logs, and errors. Example: <syntaxhighlight lang="javascript">"Name": "Lookup Anything"</syntaxhighlight> |
| |- | | |- |
− | | <tt>Author</tt> | + | | <samp>Author</samp> |
| | The name of the person who created the mod. Ideally this should include the username used to publish mods. Example: <syntaxhighlight lang="javascript">"Author": "Pathoschild"</syntaxhighlight> | | | The name of the person who created the mod. Ideally this should include the username used to publish mods. Example: <syntaxhighlight lang="javascript">"Author": "Pathoschild"</syntaxhighlight> |
| |- | | |- |
− | | <tt>Version</tt> | + | | <samp>Version</samp> |
| | The mod's [http://semver.org/ semantic version]. Make sure you update this for each release! SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). Examples: | | | The mod's [http://semver.org/ semantic version]. Make sure you update this for each release! SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). Examples: |
| <syntaxhighlight lang="javascript"> | | <syntaxhighlight lang="javascript"> |
Line 60: |
Line 60: |
| </syntaxhighlight> | | </syntaxhighlight> |
| |- | | |- |
− | | <tt>Description</tt> | + | | <samp>Description</samp> |
| | A short explanation of what your mod does (one or two sentences), shown in the SMAPI log. Example: <syntaxhighlight lang="javascript">"Description": "View metadata about anything by pressing a button."</syntaxhighlight> | | | A short explanation of what your mod does (one or two sentences), shown in the SMAPI log. Example: <syntaxhighlight lang="javascript">"Description": "View metadata about anything by pressing a button."</syntaxhighlight> |
| |- | | |- |
− | | <tt>UniqueID</tt> | + | | <samp>UniqueID</samp> |
− | | A unique identifier for your mod. The recommended format is <tt><your name>.<mod name></tt>, with no spaces or special characters. SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). When another mod needs to reference this mod, it uses the unique ID. Example: <syntaxhighlight lang="javascript">"UniqueID": "Pathoschild.LookupAnything"</syntaxhighlight> | + | | A unique identifier for your mod. The recommended format is <samp><your name>.<mod name></samp>, with no spaces or special characters. SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). When another mod needs to reference this mod, it uses the unique ID. Example: <syntaxhighlight lang="javascript">"UniqueID": "Pathoschild.LookupAnything"</syntaxhighlight> |
| |- | | |- |
− | | <tt>EntryDll</tt> '''or''' <tt>ContentPackFor</tt> | + | | <samp>EntryDll</samp> '''or''' <samp>ContentPackFor</samp> |
− | | <p>All mods must specify either <tt>EntryDll</tt> (for a SMAPI mod) or <tt>ContentPackFor</tt> (for a [[Modding:Content packs|content pack]]). These are mutually exclusive — you can't specify both.</p> | + | | <p>All mods must specify either <samp>EntryDll</samp> (for a SMAPI mod) or <samp>ContentPackFor</samp> (for a [[Modding:Content packs|content pack]]). These are mutually exclusive — you can't specify both.</p> |
| | | |
− | For a SMAPI mod, <tt>EntryDll</tt> is the mod's compiled DLL filename in its mod folder. Example: <syntaxhighlight lang="javascript">"EntryDll": "LookupAnything.dll"</syntaxhighlight> | + | For a SMAPI mod, <samp>EntryDll</samp> is the mod's compiled DLL filename in its mod folder. Example: <syntaxhighlight lang="javascript">"EntryDll": "LookupAnything.dll"</syntaxhighlight> |
| | | |
− | For a content pack, <tt>ContentPackFor</tt> specifies which mod can read it. The <tt>MinimumVersion</tt> is optional. Example: | + | For a content pack, <samp>ContentPackFor</samp> specifies which mod can read it. The <samp>MinimumVersion</samp> is optional. Example: |
| <syntaxhighlight lang="javascript"> | | <syntaxhighlight lang="javascript"> |
| "ContentPackFor": { | | "ContentPackFor": { |
Line 81: |
Line 81: |
| | | |
| ===Minimum SMAPI version=== | | ===Minimum SMAPI version=== |
− | The <tt>MinimumApiVersion</tt> fields sets the minimum SMAPI version needed to use this mod. If a player tries to use the mod with an older SMAPI version, they'll see a friendly message saying they need to update SMAPI. This also serves as a proxy for the minimum game version, since SMAPI itself enforces a minimum game version. Example: <syntaxhighlight lang="javascript">"MinimumApiVersion": "3.8.0"</syntaxhighlight> | + | The <samp>MinimumApiVersion</samp> fields sets the minimum SMAPI version needed to use this mod. If a player tries to use the mod with an older SMAPI version, they'll see a friendly message saying they need to update SMAPI. This also serves as a proxy for the minimum game version, since SMAPI itself enforces a minimum game version. Example: <syntaxhighlight lang="javascript">"MinimumApiVersion": "3.8.0"</syntaxhighlight> |
| | | |
| ===Dependencies=== | | ===Dependencies=== |
− | The <tt>Dependencies</tt> field specifies other mods required to use this mod. If a player tries to use the mod and the dependencies aren't installed, the mod won't be loaded and they'll see a friendly message saying they need to install those. For example: | + | The <samp>Dependencies</samp> field specifies other mods required to use this mod. If a player tries to use the mod and the dependencies aren't installed, the mod won't be loaded and they'll see a friendly message saying they need to install those. For example: |
| <syntaxhighlight lang="javascript"> | | <syntaxhighlight lang="javascript"> |
| "Dependencies": [ | | "Dependencies": [ |
Line 105: |
Line 105: |
| | | |
| ===Update checks=== | | ===Update checks=== |
− | SMAPI can detect new versions of your mod and alert the user with a link to your mod page. You can enable this by setting the <tt>UpdateKeys</tt> field in your <tt>manifest.json</tt>, which tells SMAPI where to check. | + | SMAPI can detect new versions of your mod and alert the user with a link to your mod page. You can enable this by setting the <samp>UpdateKeys</samp> field in your <samp>manifest.json</samp>, which tells SMAPI where to check. |
| | | |
| See [[../Update checks|''update checks'']] for more information. | | See [[../Update checks|''update checks'']] for more information. |
| | | |
| ===Anything else=== | | ===Anything else=== |
− | Any other fields will be stored in the <tt>IManifest.ExtraFields</tt> dictionary, which is available through the [[../#Mod registry|mod registry]]. Extra fields are ignored by SMAPI, but may be useful for extended metadata intended for other mods. | + | Any other fields will be stored in the <samp>IManifest.ExtraFields</samp> dictionary, which is available through the [[../#Mod registry|mod registry]]. Extra fields are ignored by SMAPI, but may be useful for extended metadata intended for other mods. |
| | | |
| [[zh:模组:制作指南/APIs/Manifest]] | | [[zh:模组:制作指南/APIs/Manifest]] |