add asset propagation for grass textures
This commit is contained in:
parent
47beb2f534
commit
04b9a810dd
|
@ -7,6 +7,9 @@
|
||||||
* Updated for the 'Force Off' gamepad mode added in Stardew Valley 1.4.0.1.
|
* Updated for the 'Force Off' gamepad mode added in Stardew Valley 1.4.0.1.
|
||||||
* Fixed compatibility issue with Arch Linux.
|
* Fixed compatibility issue with Arch Linux.
|
||||||
|
|
||||||
|
* For modders:
|
||||||
|
* Added asset propagation for grass textures.
|
||||||
|
|
||||||
* For the web UI:
|
* For the web UI:
|
||||||
* If a JSON validator upload can't be saved to Pastebin (e.g. due to rate limits), it's now uploaded to Amazon S3 instead. Files uploaded to S3 expire after one month.
|
* If a JSON validator upload can't be saved to Pastebin (e.g. due to rate limits), it's now uploaded to Amazon S3 instead. Files uploaded to S3 expire after one month.
|
||||||
* Updated the JSON validator for Content Patcher 1.10.0.
|
* Updated the JSON validator for Content Patcher 1.10.0.
|
||||||
|
|
|
@ -474,10 +474,14 @@ namespace StardewModdingAPI.Metadata
|
||||||
/****
|
/****
|
||||||
** Content\TerrainFeatures
|
** Content\TerrainFeatures
|
||||||
****/
|
****/
|
||||||
case "terrainfeatures\\flooring": // Flooring
|
case "terrainfeatures\\flooring": // from Flooring
|
||||||
Flooring.floorsTexture = content.Load<Texture2D>(key);
|
Flooring.floorsTexture = content.Load<Texture2D>(key);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case "terrainfeatures\\grass": // from Grass
|
||||||
|
this.ReloadGrassTextures(content, key);
|
||||||
|
return true;
|
||||||
|
|
||||||
case "terrainfeatures\\hoedirt": // from HoeDirt
|
case "terrainfeatures\\hoedirt": // from HoeDirt
|
||||||
HoeDirt.lightTexture = content.Load<Texture2D>(key);
|
HoeDirt.lightTexture = content.Load<Texture2D>(key);
|
||||||
return true;
|
return true;
|
||||||
|
@ -694,6 +698,35 @@ namespace StardewModdingAPI.Metadata
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Reload tree textures.</summary>
|
||||||
|
/// <param name="content">The content manager through which to reload the asset.</param>
|
||||||
|
/// <param name="key">The asset key to reload.</param>
|
||||||
|
/// <returns>Returns whether any textures were reloaded.</returns>
|
||||||
|
private bool ReloadGrassTextures(LocalizedContentManager content, string key)
|
||||||
|
{
|
||||||
|
Grass[] grasses =
|
||||||
|
(
|
||||||
|
from location in Game1.locations
|
||||||
|
from grass in location.terrainFeatures.Values.OfType<Grass>()
|
||||||
|
let textureName = this.NormalizeAssetNameIgnoringEmpty(
|
||||||
|
this.Reflection.GetMethod(grass, "textureName").Invoke<string>()
|
||||||
|
)
|
||||||
|
where textureName == key
|
||||||
|
select grass
|
||||||
|
)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
if (grasses.Any())
|
||||||
|
{
|
||||||
|
Lazy<Texture2D> texture = new Lazy<Texture2D>(() => content.Load<Texture2D>(key));
|
||||||
|
foreach (Grass grass in grasses)
|
||||||
|
this.Reflection.GetField<Lazy<Texture2D>>(grass, "texture").SetValue(texture);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Reload the disposition data for matching NPCs.</summary>
|
/// <summary>Reload the disposition data for matching NPCs.</summary>
|
||||||
/// <param name="content">The content manager through which to reload the asset.</param>
|
/// <param name="content">The content manager through which to reload the asset.</param>
|
||||||
/// <param name="key">The asset key to reload.</param>
|
/// <param name="key">The asset key to reload.</param>
|
||||||
|
|
Loading…
Reference in New Issue