Line 29: |
Line 29: |
| | | |
| ==Major changes== | | ==Major changes== |
− | ===Net fields=== | + | ===⚠ Net fields=== |
| A 'net type' is any of several new classes which Stardew Valley 1.3 uses to sync data between players, named for the <code>Net</code> prefix in their name. A net type can represent a simple value like <tt>NetBool</tt>, or complex values like <tt>NetFieldDictionary</tt>. Many existing fields have been converted to net types (called 'net fields'), each wrapping the underlying value: | | A 'net type' is any of several new classes which Stardew Valley 1.3 uses to sync data between players, named for the <code>Net</code> prefix in their name. A net type can represent a simple value like <tt>NetBool</tt>, or complex values like <tt>NetFieldDictionary</tt>. Many existing fields have been converted to net types (called 'net fields'), each wrapping the underlying value: |
| : <source lang="C#"> | | : <source lang="C#"> |
Line 42: |
Line 42: |
| Suggested fix: | | Suggested fix: |
| * With the latest mod build package installed, rebuild your project. The package will detect net field references you need to update, and show an appropriate warning. See [[#Fix common build warnings|''fix common build warnings'']] below. | | * With the latest mod build package installed, rebuild your project. The package will detect net field references you need to update, and show an appropriate warning. See [[#Fix common build warnings|''fix common build warnings'']] below. |
| + | |
| + | ===⚠ Location changes for farmhands=== |
| + | In multiplayer, if the current player isn't the main player: |
| + | * '''<tt>Game1.locations</tt> does not contain the actual list of locations'''. It contains a set of locations generated locally, which don't match the actual in-game locations. This also affects related functionality like <tt>Utility.getAllCharacters()</tt>, which searches the in-game locations. There's no fix for this yet. You can use SMAPI's <tt>helper.Multiplayer.GetActiveLocations()</tt> to get the list of locations currently being sync'd from the host, but there's currently no way to fetch all locations. That means SMAPI mods installed by a non-main player have no way to fetch all NPCs, locations, objects, etc. |
| + | * <tt>Game1.currentLocation</tt> is always an active location, but may be null when the player transition between locations. Make sure any references to that field can handle it being null. |
| | | |
| ===Game1.player.friendships is obsolete=== | | ===Game1.player.friendships is obsolete=== |
| The <tt>Game1.player.friendships</tt> field is always null in Stardew Valley 1.3. Use the new <tt>Game1.player.friendshipData</tt> field instead, which wraps the raw data with a more useful model and more data. | | The <tt>Game1.player.friendships</tt> field is always null in Stardew Valley 1.3. Use the new <tt>Game1.player.friendshipData</tt> field instead, which wraps the raw data with a more useful model and more data. |
− |
| |
− | ===Game1.currentLocation can be null===
| |
− | The <tt>Game1.currentLocation</tt> field is intermittently null for secondary players in multiplayer mode (e.g. when they transition between locations). Make sure any references to that field can handle it being null.
| |
| | | |
| ===Texture constructor arguments=== | | ===Texture constructor arguments=== |