From 1d3c99cc25f6c0d504fd5e43ea71ef327b6e9066 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 27 Mar 2022 13:42:14 -0400 Subject: split helper.Content API into game/mod content APIs --- src/SMAPI/IModContentHelper.cs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/SMAPI/IModContentHelper.cs (limited to 'src/SMAPI/IModContentHelper.cs') diff --git a/src/SMAPI/IModContentHelper.cs b/src/SMAPI/IModContentHelper.cs new file mode 100644 index 00000000..e3431365 --- /dev/null +++ b/src/SMAPI/IModContentHelper.cs @@ -0,0 +1,32 @@ +using System; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using xTile; + +namespace StardewModdingAPI +{ + /// Provides an API for loading content assets from the current mod's folder. + public interface IModContentHelper : IModLinked + { + /********* + ** Public methods + *********/ + /// Load content from the mod folder and return it. When loading a .png file, this must be called outside the game's draw loop. + /// The expected data type. The main supported types are , , dictionaries, and lists; other types may be supported by the game's content pipeline. + /// The local path to a content file relative to the mod folder. + /// The is empty or contains invalid characters. + /// The content asset couldn't be loaded (e.g. because it doesn't exist). + T Load(string relativePath); + + /// Get the internal asset name which allows loading a mod file through any of the game's content managers. This can be used when passing asset names directly to the game (e.g. for map tilesheets), but should be avoided if you can use instead. This does not validate whether the asset exists. + /// The local path to a content file relative to the mod folder. + /// The is empty or contains invalid characters. + IAssetName GetInternalAssetName(string relativePath); + + /// Get a patch helper for arbitrary data. + /// The data type. + /// The asset data. + /// The local path to the content file being edited relative to the mod folder. This is only used for tracking purposes and has no effect on the patch helper. + IAssetData GetPatchHelper(T data, string relativePath = null); + } +} -- cgit