summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-04-02 20:13:23 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-04-02 20:13:23 -0400
commit0d5b4e9983dd30fc7c586c22d69d54cd44e7a627 (patch)
tree2c853f798ba951443c7acd7c36f384d37e4f5cb0 /src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs
parentc48f6d78cc412c5f2e40a8b460b7b3c1c993c51a (diff)
downloadSMAPI-0d5b4e9983dd30fc7c586c22d69d54cd44e7a627.tar.gz
SMAPI-0d5b4e9983dd30fc7c586c22d69d54cd44e7a627.tar.bz2
SMAPI-0d5b4e9983dd30fc7c586c22d69d54cd44e7a627.zip
update resource clump logic for SDV 1.5 (#770)
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs')
-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++;
}
}