From 4a14792e4db223f1d7faf4a22759268c91186e32 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 23 Apr 2022 16:47:24 -0400 Subject: fix ReplaceWith not working for legacy IAssetEditor implementations --- src/SMAPI/Framework/Content/AssetDataForObject.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/SMAPI/Framework/Content') 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 /// The content data being read. /// Normalizes an asset key to match the cache key. /// Simplifies access to private code. - public AssetDataForObject(string? locale, IAssetName assetName, object data, Func getNormalizedPath, Reflector reflection) - : base(locale, assetName, data, getNormalizedPath, onDataReplaced: null) + /// A callback to invoke when the data is replaced (if any). + public AssetDataForObject(string? locale, IAssetName assetName, object data, Func getNormalizedPath, Reflector reflection, Action? onDataReplaced = null) + : base(locale, assetName, data, getNormalizedPath, onDataReplaced) { this.Reflection = reflection; } @@ -36,8 +37,9 @@ namespace StardewModdingAPI.Framework.Content /// The content data being read. /// Normalizes an asset key to match the cache key. /// Simplifies access to private code. - public AssetDataForObject(IAssetInfo info, object data, Func getNormalizedPath, Reflector reflection) - : this(info.Locale, info.Name, data, getNormalizedPath, reflection) { } + /// A callback to invoke when the data is replaced (if any). + public AssetDataForObject(IAssetInfo info, object data, Func getNormalizedPath, Reflector reflection, Action? onDataReplaced = null) + : this(info.Locale, info.Name, data, getNormalizedPath, reflection, onDataReplaced) { } /// public IAssetDataForDictionary AsDictionary() -- cgit