summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Program.cs')
-rw-r--r--src/StardewModdingAPI/Program.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 98de4608..53efe1e3 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -708,7 +708,7 @@ namespace StardewModdingAPI
{
// add interceptors
if (metadata.Mod.Helper.Content is ContentHelper helper)
- this.ContentManager.Editors[metadata] = helper.AssetEditors;
+ this.ContentManager.Editors[metadata] = helper.ObservableAssetEditors;
// call entry method
try
@@ -727,6 +727,20 @@ namespace StardewModdingAPI
}
}
+ // reset cache when needed
+ // only register listeners after Entry to avoid repeatedly reloading assets during load
+ foreach (IModMetadata metadata in loadedMods)
+ {
+ if (metadata.Mod.Helper.Content is ContentHelper helper)
+ {
+ helper.ObservableAssetEditors.CollectionChanged += (sender, e) =>
+ {
+ if (e.NewItems.Count > 0)
+ this.ContentManager.Reset();
+ };
+ }
+ }
+ this.ContentManager.Reset();
}
/// <summary>Reload translations for all mods.</summary>