diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-07 21:21:02 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-05-07 21:21:02 -0400 |
commit | 709638f197093ed9aaa9a3a764c85d40f4c19eac (patch) | |
tree | 3b39e0557cd86fb55647b5e3d0c783b8cf8ec48c /src/SMAPI/Framework | |
parent | f973b4c51839aa2364879ec2ba66da703f20ae06 (diff) | |
download | SMAPI-709638f197093ed9aaa9a3a764c85d40f4c19eac.tar.gz SMAPI-709638f197093ed9aaa9a3a764c85d40f4c19eac.tar.bz2 SMAPI-709638f197093ed9aaa9a3a764c85d40f4c19eac.zip |
fix assets loaded through fake content pack using parent mod's path info
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index ad6de997..c8dcf747 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1880,20 +1880,28 @@ namespace StardewModdingAPI.Framework /// <param name="packDirPath">The absolute path to the fake content pack's directory.</param> /// <param name="packManifest">The fake content pack's manifest.</param> /// <param name="contentCore">The content manager to use for mod content.</param> - /// <param name="mod">The mod for which the content pack is being created.</param> - private IContentPack CreateFakeContentPack(string packDirPath, IManifest packManifest, ContentCoordinator contentCore, IModMetadata mod) + /// <param name="parentMod">The mod for which the content pack is being created.</param> + private IContentPack CreateFakeContentPack(string packDirPath, IManifest packManifest, ContentCoordinator contentCore, IModMetadata parentMod) { - IMonitor packMonitor = this.LogManager.GetMonitor(packManifest.Name); + IModMetadata fakeMod = new ModMetadata( + displayName: $"{parentMod.DisplayName} (fake content pack: {Path.GetRelativePath(Constants.ModsPath, packDirPath)})", + directoryPath: packDirPath, + rootPath: Constants.ModsPath, + manifest: packManifest, + dataRecord: null, + isIgnored: false + ); + IMonitor packMonitor = this.LogManager.GetMonitor(packManifest.Name); IFilePathLookup relativePathCache = this.GetFilePathLookup(packDirPath); - GameContentHelper gameContentHelper = new(contentCore, mod, packManifest.Name, packMonitor, this.Reflection); - IModContentHelper packContentHelper = new ModContentHelper(contentCore, packDirPath, mod, packManifest.Name, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); - TranslationHelper packTranslationHelper = new(mod, contentCore.GetLocale(), contentCore.Language); + GameContentHelper gameContentHelper = new(contentCore, fakeMod, packManifest.Name, packMonitor, this.Reflection); + IModContentHelper packContentHelper = new ModContentHelper(contentCore, packDirPath, fakeMod, packManifest.Name, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); + TranslationHelper packTranslationHelper = new(fakeMod, contentCore.GetLocale(), contentCore.Language); ContentPack contentPack = new(packDirPath, packManifest, packContentHelper, packTranslationHelper, this.Toolkit.JsonHelper, relativePathCache); - this.ReloadTranslationsForTemporaryContentPack(mod, contentPack); - mod.FakeContentPacks.Add(new WeakReference<ContentPack>(contentPack)); + this.ReloadTranslationsForTemporaryContentPack(parentMod, contentPack); + parentMod.FakeContentPacks.Add(new WeakReference<ContentPack>(contentPack)); return contentPack; } |