From 059a59a7bcb560b938f0baf54575719e57962e0c Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 16 Jun 2019 14:12:54 -0400 Subject: fix error when loading a mod asset through a translated content manager (#647) --- src/SMAPI/Framework/ContentManagers/GameContentManager.cs | 2 +- src/SMAPI/Framework/ContentManagers/ModContentManager.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/SMAPI/Framework/ContentManagers') diff --git a/src/SMAPI/Framework/ContentManagers/GameContentManager.cs b/src/SMAPI/Framework/ContentManagers/GameContentManager.cs index ecabcaca..488ec245 100644 --- a/src/SMAPI/Framework/ContentManagers/GameContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/GameContentManager.cs @@ -82,7 +82,7 @@ namespace StardewModdingAPI.Framework.ContentManagers // get managed asset if (this.Coordinator.TryParseManagedAssetKey(assetName, out string contentManagerID, out string relativePath)) { - T managedAsset = this.Coordinator.LoadManagedAsset(assetName, contentManagerID, relativePath, language); + T managedAsset = this.Coordinator.LoadManagedAsset(contentManagerID, relativePath); if (useCache) this.Inject(assetName, managedAsset, language); return managedAsset; diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index 1d015138..2c73e861 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -30,7 +30,7 @@ namespace StardewModdingAPI.Framework.ContentManagers private readonly IContentManager GameContentManager; /// The language code for language-agnostic mod assets. - private const LanguageCode NoLanguage = LanguageCode.en; + private readonly LanguageCode DefaultLanguage = Constants.DefaultLanguage; /********* @@ -59,7 +59,7 @@ namespace StardewModdingAPI.Framework.ContentManagers /// The asset path relative to the loader root directory, not including the .xnb extension. public override T Load(string assetName) { - return this.Load(assetName, ModContentManager.NoLanguage, useCache: false); + return this.Load(assetName, this.DefaultLanguage, useCache: false); } /// Load an asset that has been processed by the content pipeline. @@ -90,8 +90,8 @@ namespace StardewModdingAPI.Framework.ContentManagers // disable language handling // Mod files don't support automatic translation logic, so this should never happen. - if (language != ModContentManager.NoLanguage) - throw new InvalidOperationException("Caching is not supported by the mod content manager."); + if (language != this.DefaultLanguage) + throw new InvalidOperationException("Localised assets aren't supported by the mod content manager."); // resolve managed asset key { -- cgit