Line 1: |
Line 1: |
| ←[[Modding:Index|Index]] | | ←[[Modding:Index|Index]] |
| | | |
− | '''This page is for modders. Players: see [[Modding:Mod compatibility]] instead.'''
| + | {{Modder compatibility header}} |
− | | |
| This page explains how to update your mod code for compatibility with SMAPI 3.0. See also [[Modding:Migrate to Stardew Valley 1.4]]. | | This page explains how to update your mod code for compatibility with SMAPI 3.0. See also [[Modding:Migrate to Stardew Valley 1.4]]. |
| | | |
Line 46: |
Line 45: |
| | | |
| For example, let's say you have code like this: | | For example, let's say you have code like this: |
− | <source lang="c#"> | + | <syntaxhighlight lang="c#"> |
| public override void Entry(IModHelper helper) | | public override void Entry(IModHelper helper) |
| { | | { |
Line 54: |
Line 53: |
| this.VaultRoomID = communityCenter.getAreaNumberFromName("Vault"); | | this.VaultRoomID = communityCenter.getAreaNumberFromName("Vault"); |
| } | | } |
− | </source> | + | </syntaxhighlight> |
| | | |
| That code fails in SMAPI 3.0, because no locations are loaded yet. This code could be rewritten like this: | | That code fails in SMAPI 3.0, because no locations are loaded yet. This code could be rewritten like this: |
− | <source lang="c#"> | + | <syntaxhighlight lang="c#"> |
| public override void Entry(IModHelper helper) | | public override void Entry(IModHelper helper) |
| { | | { |
Line 70: |
Line 69: |
| this.VaultRoomID = communityCenter.getAreaNumberFromName("Vault"); | | this.VaultRoomID = communityCenter.getAreaNumberFromName("Vault"); |
| } | | } |
− | </source> | + | </syntaxhighlight> |
| | | |
| ===API changes=== | | ===API changes=== |
Line 296: |
Line 295: |
| ===Manifest version format=== | | ===Manifest version format=== |
| The [[Modding:Modder Guide/APIs/Manifest|<tt>manifest.json</tt>]] no longer allows versions in this form: | | The [[Modding:Modder Guide/APIs/Manifest|<tt>manifest.json</tt>]] no longer allows versions in this form: |
− | <source lang="js"> | + | <syntaxhighlight lang="js"> |
| "Version": { | | "Version": { |
| "MajorVersion": 1, | | "MajorVersion": 1, |
Line 303: |
Line 302: |
| "Build": "beta" | | "Build": "beta" |
| } | | } |
− | </source> | + | </syntaxhighlight> |
| | | |
| Versions should be written in the standard string form instead: | | Versions should be written in the standard string form instead: |
− | <source lang="js"> | + | <syntaxhighlight lang="js"> |
| "Version": "1.0.0-beta" | | "Version": "1.0.0-beta" |
− | </source> | + | </syntaxhighlight> |
| | | |
| ===Version format=== | | ===Version format=== |