From 24aa8bb64d27840b9fb9ba2cbef0ab222928a21e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 2 May 2017 23:45:25 -0400 Subject: default content API to ContentSource.ModFolder (#276) --- release-notes.md | 1 + src/StardewModdingAPI/Framework/ContentHelper.cs | 4 ++-- src/StardewModdingAPI/IContentHelper.cs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/release-notes.md b/release-notes.md index b39ab276..f1aa5b15 100644 --- a/release-notes.md +++ b/release-notes.md @@ -14,6 +14,7 @@ For mod developers: See [log](https://github.com/Pathoschild/SMAPI/compare/1.11...1.12). For mod developers: +* The content API now defaults to `ContentSource.ModFolder`. * Fixed content API error when loading a PNG during early game init (e.g. in mod's `Entry`). * Fixed content API error when loading an XNB from the mod folder on Mac. diff --git a/src/StardewModdingAPI/Framework/ContentHelper.cs b/src/StardewModdingAPI/Framework/ContentHelper.cs index 61bd52a7..893fa2c8 100644 --- a/src/StardewModdingAPI/Framework/ContentHelper.cs +++ b/src/StardewModdingAPI/Framework/ContentHelper.cs @@ -49,7 +49,7 @@ namespace StardewModdingAPI.Framework /// Where to search for a matching content asset. /// The is empty or contains invalid characters. /// The content asset couldn't be loaded (e.g. because it doesn't exist). - public T Load(string key, ContentSource source) + public T Load(string key, ContentSource source = ContentSource.ModFolder) { this.AssertValidAssetKeyFormat(key); try @@ -110,7 +110,7 @@ namespace StardewModdingAPI.Framework /// The asset key to fetch (if the is ), or the local path to a content file relative to the mod folder. /// Where to search for a matching content asset. /// The is empty or contains invalid characters. - public string GetActualAssetKey(string key, ContentSource source) + public string GetActualAssetKey(string key, ContentSource source = ContentSource.ModFolder) { switch (source) { diff --git a/src/StardewModdingAPI/IContentHelper.cs b/src/StardewModdingAPI/IContentHelper.cs index 49182ce9..1d520135 100644 --- a/src/StardewModdingAPI/IContentHelper.cs +++ b/src/StardewModdingAPI/IContentHelper.cs @@ -13,12 +13,12 @@ namespace StardewModdingAPI /// Where to search for a matching content asset. /// The is empty or contains invalid characters. /// The content asset couldn't be loaded (e.g. because it doesn't exist). - T Load(string key, ContentSource source); + T Load(string key, ContentSource source = ContentSource.ModFolder); /// Get the underlying key in the game's content cache for an asset. This can be used to load custom map tilesheets, but should be avoided when you can use the content API instead. This does not validate whether the asset exists. /// The asset key to fetch (if the is ), or the local path to a content file relative to the mod folder. /// Where to search for a matching content asset. /// The is empty or contains invalid characters. - string GetActualAssetKey(string key, ContentSource source); + string GetActualAssetKey(string key, ContentSource source = ContentSource.ModFolder); } } -- cgit