From 0539bb8f3705e5c50d0e5790e2af97f39aed04b8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 6 Apr 2022 18:25:00 -0400 Subject: simplify with newer pattern features --- .../Framework/Commands/World/ClearCommand.cs | 5 ++--- src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework') diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs index d388f4b0..7935b05f 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs @@ -94,9 +94,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World this.RemoveObjects(location, obj => obj is not Chest && ( - obj.Name == "Weeds" - || obj.Name == "Stone" - || (obj.ParentSheetIndex == 294 || obj.ParentSheetIndex == 295) + obj.Name is "Weeds" or "Stone" + || obj.ParentSheetIndex is 294 or 295 ) ) + this.RemoveResourceClumps(location, clump => this.DebrisClumps.Contains(clump.parentSheetIndex.Value)); diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 9b48fa99..ca313f41 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -106,7 +106,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework { foreach (int id in this.TryLoad("Data\\weapons").Keys) { - yield return this.TryCreate(ItemType.Weapon, id, p => (p.ID >= 32 && p.ID <= 34) + yield return this.TryCreate(ItemType.Weapon, id, p => p.ID is >= 32 and <= 34 ? (Item)new Slingshot(p.ID) : new MeleeWeapon(p.ID) ); -- cgit