diff --git a/scripts/inventory/ItemSlotNode.cs b/scripts/inventory/ItemSlotNode.cs index 5425825..b1fa2b6 100644 --- a/scripts/inventory/ItemSlotNode.cs +++ b/scripts/inventory/ItemSlotNode.cs @@ -12,7 +12,6 @@ namespace ColdMint.scripts.inventory; /// public partial class ItemSlotNode : MarginContainer { - //private IItem? _item; private IItemStack? _itemStack; private TextureRect? _backgroundTextureRect; private TextureRect? _iconTextureRect; diff --git a/scripts/item/IItem.cs b/scripts/item/IItem.cs index c0cafbe..d155aa0 100644 --- a/scripts/item/IItem.cs +++ b/scripts/item/IItem.cs @@ -71,10 +71,6 @@ public interface IItem /// If this item need a special stack type, return the special item stack instance that contains the item. If else, just leave this null. /// 如果该项目需要特殊的物品堆类型,重写此方法来返回包含该物品的特殊物品堆实例。否则,保留原本的null返回值。 /// - /// - /// DO NOT use this method to create stack from item, use instead - /// 不要使用此方法从一个物品创建堆,请使用 。 - /// /// IItemStack? SpecialStack() => null; } \ No newline at end of file diff --git a/scripts/item/itemStacks/IItemStack.cs b/scripts/item/itemStacks/IItemStack.cs index 5ba7d17..5437473 100644 --- a/scripts/item/itemStacks/IItemStack.cs +++ b/scripts/item/itemStacks/IItemStack.cs @@ -159,6 +159,10 @@ public interface IItemStack /// Create a new ItemStack with the given item as the first item /// 以给定的物品为第一个物品创建物品堆 /// + /// + ///Assuming the item implements the method, then use the return value of the SpecialStack method, otherwise extrapolate from the maximum number of stacks of items. + ///假设物品实现了方法,那么使用SpecialStack方法的返回值,否则根据物品的最大堆叠数量来推断。 + /// public static IItemStack FromItem(IItem item) => item.SpecialStack() ?? ItemTypeManager.MaxStackQuantityOf(item.Id) switch