summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Framework/Content/AssetDataForObject.cs10
-rw-r--r--src/SMAPI/Framework/ContentCoordinator.cs3
2 files changed, 8 insertions, 5 deletions
diff --git a/src/SMAPI/Framework/Content/AssetDataForObject.cs b/src/SMAPI/Framework/Content/AssetDataForObject.cs
index e508ca30..6c40f5f9 100644
--- a/src/SMAPI/Framework/Content/AssetDataForObject.cs
+++ b/src/SMAPI/Framework/Content/AssetDataForObject.cs
@@ -25,8 +25,9 @@ namespace StardewModdingAPI.Framework.Content
/// <param name="data">The content data being read.</param>
/// <param name="getNormalizedPath">Normalizes an asset key to match the cache key.</param>
/// <param name="reflection">Simplifies access to private code.</param>
- public AssetDataForObject(string? locale, IAssetName assetName, object data, Func<string, string> getNormalizedPath, Reflector reflection)
- : base(locale, assetName, data, getNormalizedPath, onDataReplaced: null)
+ /// <param name="onDataReplaced">A callback to invoke when the data is replaced (if any).</param>
+ public AssetDataForObject(string? locale, IAssetName assetName, object data, Func<string, string> getNormalizedPath, Reflector reflection, Action<object>? onDataReplaced = null)
+ : base(locale, assetName, data, getNormalizedPath, onDataReplaced)
{
this.Reflection = reflection;
}
@@ -36,8 +37,9 @@ namespace StardewModdingAPI.Framework.Content
/// <param name="data">The content data being read.</param>
/// <param name="getNormalizedPath">Normalizes an asset key to match the cache key.</param>
/// <param name="reflection">Simplifies access to private code.</param>
- public AssetDataForObject(IAssetInfo info, object data, Func<string, string> getNormalizedPath, Reflector reflection)
- : this(info.Locale, info.Name, data, getNormalizedPath, reflection) { }
+ /// <param name="onDataReplaced">A callback to invoke when the data is replaced (if any).</param>
+ public AssetDataForObject(IAssetInfo info, object data, Func<string, string> getNormalizedPath, Reflector reflection, Action<object>? onDataReplaced = null)
+ : this(info.Locale, info.Name, data, getNormalizedPath, reflection, onDataReplaced) { }
/// <inheritdoc />
public IAssetDataForDictionary<TKey, TValue> AsDictionary<TKey, TValue>()
diff --git a/src/SMAPI/Framework/ContentCoordinator.cs b/src/SMAPI/Framework/ContentCoordinator.cs
index aade7b36..93b6d9f3 100644
--- a/src/SMAPI/Framework/ContentCoordinator.cs
+++ b/src/SMAPI/Framework/ContentCoordinator.cs
@@ -716,7 +716,8 @@ namespace StardewModdingAPI.Framework
assetName: legacyName,
data: asset.Data,
getNormalizedPath: this.MainContentManager.AssertAndNormalizeAssetName,
- reflection: this.Reflection
+ reflection: this.Reflection,
+ onDataReplaced: asset.ReplaceWith
);
}