summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs
diff options
context:
space:
mode:
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>