summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModHelpers/ModHelper.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-02-18 14:18:41 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-02-18 14:18:41 -0500
commite7cb44efb7cc4fec1dc36c6110be0c948581be85 (patch)
treefa27e77f03415ddabb9c7060455c9a1eda099c8b /src/SMAPI/Framework/ModHelpers/ModHelper.cs
parent0c1bca3db044b6f228538f1738d52c31e4481e48 (diff)
parentf0cddebbe956262cb3645c6e9d27ca0cfb056125 (diff)
downloadSMAPI-e7cb44efb7cc4fec1dc36c6110be0c948581be85.tar.gz
SMAPI-e7cb44efb7cc4fec1dc36c6110be0c948581be85.tar.bz2
SMAPI-e7cb44efb7cc4fec1dc36c6110be0c948581be85.zip
Merge branch 'add-content-packs' into develop
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers/ModHelper.cs')
-rw-r--r--src/SMAPI/Framework/ModHelpers/ModHelper.cs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ModHelper.cs b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
index 665b9cf4..c73dc307 100644
--- a/src/SMAPI/Framework/ModHelpers/ModHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
@@ -1,5 +1,7 @@
-using System;
+using System;
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
using StardewModdingAPI.Framework.Serialisation;
namespace StardewModdingAPI.Framework.ModHelpers
@@ -13,6 +15,9 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <summary>Encapsulates SMAPI's JSON file parsing.</summary>
private readonly JsonHelper JsonHelper;
+ /// <summary>The content packs loaded for this mod.</summary>
+ private readonly IContentPack[] ContentPacks;
+
/*********
** Accessors
@@ -48,9 +53,10 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <param name="modRegistry">an API for fetching metadata about loaded mods.</param>
/// <param name="reflectionHelper">An API for accessing private game code.</param>
/// <param name="translationHelper">An API for reading translations stored in the mod's <c>i18n</c> folder.</param>
+ /// <param name="contentPacks">The content packs loaded for this mod.</param>
/// <exception cref="ArgumentNullException">An argument is null or empty.</exception>
/// <exception cref="InvalidOperationException">The <paramref name="modDirectory"/> path does not exist on disk.</exception>
- public ModHelper(string modID, string modDirectory, JsonHelper jsonHelper, IContentHelper contentHelper, ICommandHelper commandHelper, IModRegistry modRegistry, IReflectionHelper reflectionHelper, ITranslationHelper translationHelper)
+ public ModHelper(string modID, string modDirectory, JsonHelper jsonHelper, IContentHelper contentHelper, ICommandHelper commandHelper, IModRegistry modRegistry, IReflectionHelper reflectionHelper, ITranslationHelper translationHelper, IEnumerable<IContentPack> contentPacks)
: base(modID)
{
// validate directory
@@ -67,6 +73,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
this.ConsoleCommands = commandHelper ?? throw new ArgumentNullException(nameof(commandHelper));
this.Reflection = reflectionHelper ?? throw new ArgumentNullException(nameof(reflectionHelper));
this.Translation = translationHelper ?? throw new ArgumentNullException(nameof(translationHelper));
+ this.ContentPacks = contentPacks.ToArray();
}
/****
@@ -116,6 +123,14 @@ namespace StardewModdingAPI.Framework.ModHelpers
this.JsonHelper.WriteJsonFile(path, model);
}
+ /****
+ ** Content packs
+ ****/
+ /// <summary>Get all content packs loaded for this mod.</summary>
+ public IEnumerable<IContentPack> GetContentPacks()
+ {
+ return this.ContentPacks;
+ }
/****
** Disposal