Interface IItemStack
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Represents a stack of items or blocks
public interface IItemStack
- Extension Methods
Properties
Attributes
Attributes assigned to this itemstack. Modifiable.
ITreeAttribute Attributes { get; set; }
Property Value
Block
The Block if ItemClass==Block, otherwise null
Block Block { get; }
Property Value
Class
Is it a Block or Item?
EnumItemClass Class { get; }
Property Value
Collectible
The base class the Item/Block inherits from
CollectibleObject Collectible { get; }
Property Value
Id
The items or blocks unique id
int Id { get; }
Property Value
Item
The Item if ItemClass==Item, otherwise null
Item Item { get; }
Property Value
StackSize
Amount of items or blocks in this stack
int StackSize { get; set; }
Property Value
Methods
Clone()
Creates a deep copy of the itemstack
ItemStack Clone()
Returns
Equals(IWorldAccessor, ItemStack, params string[])
Checks if this item stack is of the same class, id and has the same stack attributes. Ignores stack size
bool Equals(IWorldAccessor worldForResolve, ItemStack sourceStack, params string[] ignoreAttributeSubTrees)
Parameters
worldForResolve
IWorldAccessorsourceStack
ItemStackignoreAttributeSubTrees
string[]
Returns
FromBytes(BinaryReader)
Deserializes an itemstack from given byte stream
void FromBytes(BinaryReader stream)
Parameters
stream
BinaryReader
GetDescription(IWorldAccessor, ItemSlot, bool)
Returns a multiline description text of the item
string GetDescription(IWorldAccessor world, ItemSlot inSlot, bool debug = false)
Parameters
world
IWorldAccessorinSlot
ItemSlotdebug
boolWhether to show additional debug info
Returns
GetName()
Returns the name displayed in the players inventory
string GetName()
Returns
MatchesSearchText(IWorldAccessor, string)
Checks if the contained item or block name contains given searchtext
bool MatchesSearchText(IWorldAccessor world, string searchText)
Parameters
world
IWorldAccessorsearchText
string
Returns
ToBytes(BinaryWriter)
Serializes this itemstack into a byte stream
void ToBytes(BinaryWriter stream)
Parameters
stream
BinaryWriter