summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
index 4b0e45a0..4cfaf242 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using StardewValley;
using StardewValley.Locations;
@@ -224,18 +223,17 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World
{
int removed = 0;
- // get resource clumps
- IList<ResourceClump> resourceClumps =
- (location as Farm)?.resourceClumps
- ?? (IList<ResourceClump>)(location as Woods)?.stumps
- ?? new List<ResourceClump>();
+ foreach (var clump in location.resourceClumps.Where(shouldRemove).ToArray())
+ {
+ location.resourceClumps.Remove(clump);
+ removed++;
+ }
- // remove matching clumps
- foreach (var clump in resourceClumps.ToArray())
+ if (location is Woods woods)
{
- if (shouldRemove(clump))
+ foreach (ResourceClump clump in woods.stumps.Where(shouldRemove).ToArray())
{
- resourceClumps.Remove(clump);
+ woods.stumps.Remove(clump);
removed++;
}
}