summaryrefslogtreecommitdiff
path: root/src/SMAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI')
-rw-r--r--src/SMAPI/Framework/ModRegistry.cs10
-rw-r--r--src/SMAPI/Framework/SCore.cs1
2 files changed, 9 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/ModRegistry.cs b/src/SMAPI/Framework/ModRegistry.cs
index e9ceb66e..5be33cb4 100644
--- a/src/SMAPI/Framework/ModRegistry.cs
+++ b/src/SMAPI/Framework/ModRegistry.cs
@@ -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>
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs
index 27c0c40b..46e1de8d 100644
--- a/src/SMAPI/Framework/SCore.cs
+++ b/src/SMAPI/Framework/SCore.cs
@@ -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
{