Difference between revisions of "Modding:Migrate to Stardew Valley 1.3"

From Stardew Valley Wiki
Jump to navigation Jump to search
(→‎Overview: tweak multiplayer note)
(split Content Patcher and XNB updates to Modding:Migrate XNB changes to Stardew Valley 1.3)
Line 1: Line 1:
 
←[[Modding:Index|Index]]
 
←[[Modding:Index|Index]]
  
'''This page is for modders. Players: see [[Modding:SMAPI compatibility]] instead.'''
+
'''This page is for modders. Players: see [[Modding:SMAPI compatibility]] instead.''' For updating Content Patcher or XNB mods, see [[Modding:Migrate XNB changes to Stardew Valley 1.3|''Migrate XNB changes to Stardew Valley 1.3'']].
  
This page explains how to update your mod code for compatibility with Stardew Valley 1.3.
+
This page explains how to update your SMAPI mod code for compatibility with Stardew Valley 1.3.
  
 
==SMAPI mods==
 
==SMAPI mods==
Line 59: Line 59:
  
 
* "''The '{0}' field is obsolete and should be replaced with '{1}'. See https://smapi.io/buildmsg/smapi003 for details.''"<br />You're referencing a field which should no longer be used. Just use the suggested field name instead to fix it.
 
* "''The '{0}' field is obsolete and should be replaced with '{1}'. See https://smapi.io/buildmsg/smapi003 for details.''"<br />You're referencing a field which should no longer be used. Just use the suggested field name instead to fix it.
 
==XNB mods and Content Patcher==
 
===XNB mods deprecated===
 
XNB mods are no longer recommended. Consider using [https://www.nexusmods.com/stardewvalley/mods/1915 Content Patcher] instead.
 
 
===Impact in 1.3===
 
Here are the XNB changes in Stardew Valley 1.3.
 
 
Notes:
 
* I ignored changes to non-English files for simplicity.
 
* New content files aren't listed, since they won't impact existing mods and to avoid spoiling some surprises.
 
* XNB mods are disproportionately affected, since they replace the entire file. Content Patcher packs are typically unaffected unless they replace the entire file (in which case see the XNB mod column).
 
* I don't know what changed in affected map files (if anything), only that the files are different.
 
 
Shorthand:
 
* 'broken' means removing new content or potentially important changes, or potentially causing significant display bugs. This is a broad category — the game may work fine without it or crash, depending how it uses that specific content.
 
* 'mostly unaffected' means mods will only be affected if they edit specific entries or fields.
 
* Blank means zero expected impact.
 
 
{| class="wikitable"
 
|-
 
! content file
 
! changes
 
! XNB
 
! Content Patcher
 
|-
 
| <tt>Characters/Dialogue/Abigail</tt>
 
| new content
 
| '''✘ broken'''
 
|
 
|-
 
| <tt>Characters/Dialogue/Alex</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Abigail</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Clint</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Demetrius</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Elliott</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Emily</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Evelyn</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/George</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Gus</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Haley</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Harvey</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Krobus</tt>
 
| small text change
 
| ✘ minor issues
 
| ✓ mostly unaffected
 
|-
 
| <tt>Characters/Dialogue/Leah</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Lewis</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Linus</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/`<br />`MarriageDialogueSebastian</tt>
 
| small text change
 
| ✘ minor issues
 
| ✓ mostly unaffected
 
|-
 
| <tt>Characters/Dialogue/Maru</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Pam</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Penny</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Pierre</tt>
 
| new content + small text change
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Characters/Dialogue/Robin</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Sam</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Sebastian</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Dialogue/Shane</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Characters/Farmer/hats</tt>
 
| new sprites at bottom
 
| '''✘ broken'''
 
| ✘ impacts new-hat packs
 
|-
 
| <tt>Characters/Governor</tt>
 
| new sprites at bottom
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Characters/Pam</tt>
 
| new sprites at bottom
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Characters/Penny</tt>
 
| new sprites in empty slot
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Characters/schedules/Abigail</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Alex</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Caroline</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Clint</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Demetrius</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Elliott</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Emily</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Evelyn</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/George</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Gus</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Haley</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Harvey</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Jas</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Jodi</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Leah</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Lewis</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Linus</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Marnie</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Maru</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Penny</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Pierre</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Robin</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Sam</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Sebastian</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Shane</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Vincent</tt>
 
| format change
 
| '''✘ broken'''
 
|  '''✘ broken'''
 
|-
 
| <tt>Characters/schedules/Willy</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Data/BigCraftablesInformation</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Blueprints</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/CraftingRecipies</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Crops</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Events/ArchaeologyHouse</tt>
 
| minor change
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/Beach</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/BusStop</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Events/Farm</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/FarmHouse</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/Forest</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Events/HaleyHouse</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Events/Mountain</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/Saloon</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Events/SeedShop</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/Town</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/WizardHouse</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Events/Woods</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/ExtraDialogue</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Festivals/fall27</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Festivals/spring13</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Festivals/spring24</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Festivals/summer11</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Festivals/summer28</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Festivals/winter8</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/Fish</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Furniture</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Monsters</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/NPCGiftTastes</tt>
 
| changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/ObjectInformation</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/Quests</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Data/animationDescriptions</tt>
 
| format change
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>Data/hats</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Data/mail</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>LooseSprites/ControllerMaps</tt>
 
| cosmetic changes
 
| ✘ minor issues
 
| ✘ minor issues
 
|-
 
| <tt>LooseSprites/Cursors</tt>
 
| new content + changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>LooseSprites/chatBox</tt>
 
| significantly changed
 
| '''✘ broken'''
 
| '''✘ broken'''
 
|-
 
| <tt>LooseSprites/letterBG</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>LooseSprites/map</tt>
 
| cosmetic changes
 
| ✘ minor issues
 
 
|-
 
| <tt>Maps/Farm</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/FarmHouse</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/FarmHouse1</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/FarmHouse1_marriage</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/FarmHouse2</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/FarmHouse2_marriage</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/Farm_Combat</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/Farm_Fishing</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/Farm_Foraging</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/Farm_Mining</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/Railroad</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/Sewer</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/sewerTiles</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Maps/Town</tt>
 
| unknown changes
 
| '''✘ broken?'''
 
| '''✘ broken?'''
 
|-
 
| <tt>Maps/fall_town</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Maps/paths</tt>
 
| new content
 
| ✘ minor issues
 
 
|-
 
| <tt>Maps/spring_town</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Maps/springobjects</tt>
 
| new content + cosmetic changes
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Maps/summer_town</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Maps/winter_town</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Portraits/MrQi</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>SewerTiles</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>Strings/Characters</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Strings/Events</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Strings/Locations</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Strings/Objects</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Strings/StringsFromCSFiles</tt>
 
| new content
 
| '''✘ broken'''
 
 
|-
 
| <tt>Strings/UI</tt>
 
| new content + changes
 
| '''✘ broken'''
 
 
|-
 
| <tt>TileSheets/Craftables</tt>
 
| new content + significant changes<br /><small>([https://i.imgur.com/a2MRcqD.png replaced sprites in red, edited in orange])</small>
 
| '''✘ broken'''
 
| '''✘ possibly broken'''
 
|-
 
| <tt>TileSheets/crops</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>TileSheets/furniture</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>fall_town</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>paths</tt>
 
| new content
 
| ✘ minor issues
 
 
|-
 
| <tt>spring_town</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|-
 
| <tt>winter_town</tt>
 
| new content
 
| '''✘ broken'''
 
| ✓ mostly unaffected
 
|}
 
  
 
[[Category:Modding]]
 
[[Category:Modding]]

Revision as of 03:08, 20 April 2018

Index

This page is for modders. Players: see Modding:SMAPI compatibility instead. For updating Content Patcher or XNB mods, see Migrate XNB changes to Stardew Valley 1.3.

This page explains how to update your SMAPI mod code for compatibility with Stardew Valley 1.3.

SMAPI mods

Overview

At a high level, here's how to update a SMAPI mod:

  1. Update the mod build NuGet package to 2.1-beta. (You may need to enable the 'include prerelease' checkbox to see the beta.)
    This adds support for Stardew Valley 1.3, and adds code analysis which will report common problems in Stardew Valley 1.3 as compiler warnings.
  2. Rebuild your solution.
  3. Fix any compiler errors and warnings you see in the Error List pane in Visual Studio (or equivalent for other editors).
  4. See below for help with specific changes and warnings.
  5. Test all mod features to make sure they work.

That should take care of compatibility in single-player mode. The game will automatically synchronise most world changes to other players, but you might need further changes to work in multiplayer mode. Questions to consider: will your mod cause any problems if two players both have it installed? Do you have any custom objects/buildings/etc that might get synchronised to other players, and will that synchronisation work correctly? What if they have different configuration? Maybe it should only work for the main player? You can use SMAPI's Context.IsSinglePlayer and Context.IsMainPlayer flags in your logic to avoid conflicts.

If you need help updating your code, feel free to ask questions on the Stardew Valley Discord.

Net types

Stardew Valley 1.3 uses net types (like NetBool and NetInt) to handle multiplayer sync. These types can implicitly convert to their equivalent normal values (like bool x = new NetBool()), but their conversion rules are unintuitive and error-prone. For example, item?.category == null && item?.category != null can both be true at once, and building.indoors != null will be true for a null value in some cases. With the mod build config package installed, rebuild the project and look for warnings in the Error List pane like this:

'{{expression}}' is a {{net type}} field; consider using the {{property name}} property instead. See https://smapi.io/buildmsg/smapi002 for details.

This implicitly converts '{{expression}}' from {{net type}} to {{other type}}, but {{net type}} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/smapi001 for details.

Suggested fix:

  • Some net fields have an equivalent non-net property, like monster.Health (int) instead of monster.health (NetBool). The mod build package will add a SMAPI002 warning which says which property to use instead.
  • For a reference type (i.e. one that can contain null), you can use the .Value property (or .FieldDict for a NetDictionary):
    if (building.indoors.Value == null)
    

    Or convert the value before comparison:

    GameLocation indoors = building.indoors;
    if(indoors == null)
       // ...
    
  • For a value type (i.e. one that can't contain null), check if the object is null (if applicable) and compare with .Value:
    if (item != null && item.category.Value == 0)
    

Game1.player.friendships

This field is always null in Stardew Valley 1.3. Use the new Game1.player.friendshipData field instead, which wraps the raw data with a model.

Texture constructor arguments

Many constructors which previously accepted Texture2D texture arguments now take a string textureName argument instead. It's usually better to use SMAPI's content API to override textures instead. You can change the cached texture after the object is constructed (may need reflection), but don't change the texture name to avoid multiplayer sync issues.

Common compiler warnings

Make sure you check your Error List pane in Visual Studio (or equivalent in other IDEs) and fix any warnings. Here are some common ones:

  • "There was a mismatch between the processor architecture of the project being built "{0}" and the processor architecture of the reference "{1}". This mismatch may cause runtime failures."
    That warning is normal. The error is saying that your build is set to 'Any CPU', but Stardew Valley is x86-only so it'll only work in x86 anyway. You can either ignore it, or change your platform target to x86.
  • "This implicitly converts '{0}' from {1} to {2}, but {1} has unintuitive implicit conversion rules. Consider comparing against the actual value instead to avoid bugs. See https://smapi.io/buildmsg/smapi001 for details."
    See #Net types.
  • "The '{0}' field is obsolete and should be replaced with '{1}'. See https://smapi.io/buildmsg/smapi003 for details."
    You're referencing a field which should no longer be used. Just use the suggested field name instead to fix it.