add backwards compatibility for loading content assets with .xnb extension
This commit is contained in:
parent
8425c82033
commit
d7d8cdaa5a
|
@ -76,7 +76,7 @@ namespace StardewModdingAPI.Framework.Content
|
|||
{
|
||||
key = this.NormalizePathSeparators(key);
|
||||
return key.EndsWith(".xnb", StringComparison.OrdinalIgnoreCase)
|
||||
? key.Substring(0, key.Length - 4)
|
||||
? key[..^4]
|
||||
: key;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,17 @@ namespace StardewModdingAPI.Framework.ModHelpers
|
|||
switch (source)
|
||||
{
|
||||
case ContentSource.GameContent:
|
||||
if (assetName.Name.EndsWith(".xnb", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
assetName = this.ContentCore.ParseAssetName(assetName.Name[..^4], allowLocales: true);
|
||||
SCore.DeprecationManager.Warn(
|
||||
this.Mod,
|
||||
"loading assets from the Content folder with a .xnb file extension",
|
||||
"3.14.0",
|
||||
DeprecationLevel.Notice
|
||||
);
|
||||
}
|
||||
|
||||
return this.GameContentManager.LoadLocalized<T>(assetName, this.CurrentLocaleConstant, useCache: false);
|
||||
|
||||
case ContentSource.ModFolder:
|
||||
|
|
Loading…
Reference in New Issue