summaryrefslogtreecommitdiff
path: root/src/SMAPI/Metadata/CoreAssetPropagator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Metadata/CoreAssetPropagator.cs')
-rw-r--r--src/SMAPI/Metadata/CoreAssetPropagator.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs
index 985e4e1b..8b00d893 100644
--- a/src/SMAPI/Metadata/CoreAssetPropagator.cs
+++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs
@@ -611,7 +611,7 @@ namespace StardewModdingAPI.Metadata
{
// get buildings
string type = Path.GetFileName(key);
- Building[] buildings = Game1.locations
+ Building[] buildings = this.GetLocations(buildingInteriors: false)
.OfType<BuildableGameLocation>()
.SelectMany(p => p.buildings)
.Where(p => p.buildingType.Value == type)
@@ -706,7 +706,7 @@ namespace StardewModdingAPI.Metadata
{
Grass[] grasses =
(
- from location in Game1.locations
+ from location in this.GetLocations()
from grass in location.terrainFeatures.Values.OfType<Grass>()
let textureName = this.NormalizeAssetNameIgnoringEmpty(
this.Reflection.GetMethod(grass, "textureName").Invoke<string>()
@@ -804,7 +804,7 @@ namespace StardewModdingAPI.Metadata
/// <returns>Returns whether any textures were reloaded.</returns>
private bool ReloadTreeTextures(LocalizedContentManager content, string key, int type)
{
- Tree[] trees = Game1.locations
+ Tree[] trees = this.GetLocations()
.SelectMany(p => p.terrainFeatures.Values.OfType<Tree>())
.Where(tree => tree.treeType.Value == type)
.ToArray();
@@ -909,7 +909,8 @@ namespace StardewModdingAPI.Metadata
}
/// <summary>Get all locations in the game.</summary>
- private IEnumerable<GameLocation> GetLocations()
+ /// <param name="buildingInteriors">Whether to also get the interior locations for constructable buildings.</param>
+ private IEnumerable<GameLocation> GetLocations(bool buildingInteriors = true)
{
// get available root locations
IEnumerable<GameLocation> rootLocations = Game1.locations;
@@ -921,7 +922,7 @@ namespace StardewModdingAPI.Metadata
{
yield return location;
- if (location is BuildableGameLocation buildableLocation)
+ if (buildingInteriors && location is BuildableGameLocation buildableLocation)
{
foreach (Building building in buildableLocation.buildings)
{