summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/ModMetadata.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-03 18:36:39 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-09-03 18:36:39 -0400
commitc5b8cd626489dad6210fe629658314dfc85f4d08 (patch)
tree3e30c3172e6c0bb3e422036581684593156fad22 /src/SMAPI/Framework/ModLoading/ModMetadata.cs
parent4ee96a20bb6c74bc7ff6176a03e7f15d47cddfa8 (diff)
parent6d4ea7f0bd584602632e6e308d52bb369b30006f (diff)
downloadSMAPI-c5b8cd626489dad6210fe629658314dfc85f4d08.tar.gz
SMAPI-c5b8cd626489dad6210fe629658314dfc85f4d08.tar.bz2
SMAPI-c5b8cd626489dad6210fe629658314dfc85f4d08.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/ModMetadata.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/ModMetadata.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
index 0ace084f..9e6bc61f 100644
--- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs
+++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
@@ -83,6 +83,9 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <inheritdoc />
public bool IsContentPack => this.Manifest?.ContentPackFor != null;
+ /// <summary>The fake content packs created by this mod, if any.</summary>
+ public ISet<WeakReference<ContentPack>> FakeContentPacks { get; } = new HashSet<WeakReference<ContentPack>>();
+
/*********
** Public methods
@@ -244,6 +247,21 @@ namespace StardewModdingAPI.Framework.ModLoading
return Path.Combine(rootFolderName, this.RelativeDirectoryPath);
}
+ /// <summary>Get the currently live fake content packs created by this mod.</summary>
+ public IEnumerable<ContentPack> GetFakeContentPacks()
+ {
+ foreach (var reference in this.FakeContentPacks.ToArray())
+ {
+ if (!reference.TryGetTarget(out ContentPack pack))
+ {
+ this.FakeContentPacks.Remove(reference);
+ continue;
+ }
+
+ yield return pack;
+ }
+ }
+
/*********
** Private methods