summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-10-24 18:26:41 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-10-24 18:26:41 -0400
commit7c652b0924476cea8dc89faa30983e01c0c66fec (patch)
tree4ecb75817b2427f14d54341b3d7e0ad7d6416e6a /src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs
parent70cf63c9075a126e7254b82d2d8109a451313920 (diff)
downloadSMAPI-7c652b0924476cea8dc89faa30983e01c0c66fec.tar.gz
SMAPI-7c652b0924476cea8dc89faa30983e01c0c66fec.tar.bz2
SMAPI-7c652b0924476cea8dc89faa30983e01c0c66fec.zip
update item repo to allow creating instances later
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs
index d9e63126..3675a963 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs
@@ -12,9 +12,12 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData
/// <summary>The item type.</summary>
public ItemType Type { get; }
- /// <summary>The item instance.</summary>
+ /// <summary>A sample item instance.</summary>
public Item Item { get; }
+ /// <summary>Create an item instance.</summary>
+ public Func<Item> CreateItem { get; }
+
/// <summary>The item's unique ID for its type.</summary>
public int ID { get; }
@@ -31,12 +34,13 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData
/// <summary>Construct an instance.</summary>
/// <param name="type">The item type.</param>
/// <param name="id">The unique ID (if different from the item's parent sheet index).</param>
- /// <param name="item">The item instance.</param>
- public SearchableItem(ItemType type, int id, Item item)
+ /// <param name="createItem">Create an item instance.</param>
+ public SearchableItem(ItemType type, int id, Func<SearchableItem, Item> createItem)
{
this.Type = type;
this.ID = id;
- this.Item = item;
+ this.CreateItem = () => createItem(this);
+ this.Item = createItem(this);
}
/// <summary>Get whether the item name contains a case-insensitive substring.</summary>