fix 'unknown mod' deprecation warnings when they occur in the Mod constructor
This commit is contained in:
parent
c4a76df4b0
commit
0f926ca1c9
|
@ -5,6 +5,7 @@
|
|||
* Added mod page link to 'missing dependency' errors for the most common dependencies.
|
||||
* Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released).
|
||||
* Fixed 'unknown mod' deprecation warnings showing a stack trace when developers mode not enabled.
|
||||
* Fixed 'unknown mod' deprecation warnings when they occur in the Mod constructor.
|
||||
|
||||
* For modders:
|
||||
* Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event.
|
||||
|
|
|
@ -33,8 +33,14 @@ namespace StardewModdingAPI.Framework
|
|||
public void Add(IModMetadata metadata)
|
||||
{
|
||||
this.Mods.Add(metadata);
|
||||
if (!metadata.IsContentPack)
|
||||
this.ModNamesByAssembly[metadata.Mod.GetType().Assembly.FullName] = metadata;
|
||||
}
|
||||
|
||||
/// <summary>Track a mod's assembly for use via <see cref="GetFrom"/>.</summary>
|
||||
/// <param name="metadata">The mod metadata.</param>
|
||||
/// <param name="modAssembly">The mod assembly.</param>
|
||||
public void TrackAssemblies(IModMetadata metadata, Assembly modAssembly)
|
||||
{
|
||||
this.ModNamesByAssembly[modAssembly.FullName] = metadata;
|
||||
}
|
||||
|
||||
/// <summary>Get metadata for all loaded mods.</summary>
|
||||
|
|
|
@ -977,6 +977,7 @@ namespace StardewModdingAPI.Framework
|
|||
try
|
||||
{
|
||||
modAssembly = assemblyLoader.Load(mod, assemblyPath, assumeCompatible: mod.DataRecord?.Status == ModStatus.AssumeCompatible);
|
||||
this.ModRegistry.TrackAssemblies(mod, modAssembly);
|
||||
}
|
||||
catch (IncompatibleInstructionException) // details already in trace logs
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue