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, 12 insertions, 4 deletions
diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs
index 50ab4e25..56c56431 100644
--- a/src/StardewModdingAPI/Program.cs
+++ b/src/StardewModdingAPI/Program.cs
@@ -796,7 +796,7 @@ namespace StardewModdingAPI
if (this.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] { typeof(object[]) }))
deprecationWarnings.Add(() => this.DeprecationManager.Warn(metadata.DisplayName, $"{nameof(Mod)}.{nameof(Mod.Entry)}(object[]) instead of {nameof(Mod)}.{nameof(Mod.Entry)}({nameof(IModHelper)})", "1.0", DeprecationLevel.PendingRemoval));
#else
- if (!this.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] {typeof(IModHelper)}))
+ if (!this.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] { typeof(IModHelper) }))
this.Monitor.Log($"{metadata.DisplayName} doesn't implement Entry() and may not work correctly.", LogLevel.Error);
#endif
}
@@ -812,19 +812,27 @@ namespace StardewModdingAPI
{
if (metadata.Mod.Helper.Content is ContentHelper helper)
{
+ // TODO: optimise by only reloading assets the new editors/loaders can intercept
helper.ObservableAssetEditors.CollectionChanged += (sender, e) =>
{
if (e.NewItems.Count > 0)
- this.ContentManager.Reset();
+ {
+ this.Monitor.Log("Detected new asset editor, resetting cache...", LogLevel.Trace);
+ this.ContentManager.InvalidateCache(p => true);
+ }
};
helper.ObservableAssetLoaders.CollectionChanged += (sender, e) =>
{
if (e.NewItems.Count > 0)
- this.ContentManager.Reset();
+ {
+ this.Monitor.Log("Detected new asset loader, resetting cache...", LogLevel.Trace);
+ this.ContentManager.InvalidateCache(p => true);
+ }
};
}
}
- this.ContentManager.Reset();
+ this.Monitor.Log("Resetting cache to enable interception...", LogLevel.Trace);
+ this.ContentManager.InvalidateCache(p => true);
}
/// <summary>Reload translations for all mods.</summary>