Class InventoryInfinite
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
A inventory meant for block entities, with no upper limit in size (int.MaxValue, to be precise) Open in GitHub
public class InventoryInfinite : InventoryBase, IInventory, IReadOnlyCollection<ItemSlot>, IEnumerable<ItemSlot>, IEnumerable
- Inheritance
-
InventoryInfinite
- Implements
- Inherited Members
- Extension Methods
Constructors
InventoryInfinite(NewInfSlotDelegate)
Creates an inventory with no upper limit in size (int.MaxValue, to be precise)
public InventoryInfinite(NewInfSlotDelegate onNewSlot = null)
Parameters
onNewSlotNewInfSlotDelegate
Fields
OnGetAutoPullFromSlot
public GetAutoPullFromSlotDelegate OnGetAutoPullFromSlot
Field Value
OnGetAutoPushIntoSlot
public GetAutoPushIntoSlotDelegate OnGetAutoPushIntoSlot
Field Value
OnGetSuitability
public GetSuitabilityDelegate OnGetSuitability
Field Value
SlotsByslotId
public OrderedDictionary<string, ItemSlot> SlotsByslotId
Field Value
Properties
BaseWeight
public float BaseWeight { get; set; }
Property Value
Count
Amount of defined slots
public override int Count { get; }
Property Value
this[int]
Gets or sets the slot at the given slot number. Returns null for invalid slot number (below 0 or above Count-1). The setter allows for replacing slots with custom ones, though caution is advised.
public override ItemSlot this[int slotId] { get; set; }
Parameters
slotIdint
Property Value
this[string]
public ItemSlot this[string slotId] { get; set; }
Parameters
slotIdstring
Property Value
PerishableFactorByFoodCategory
public Dictionary<EnumFoodCategory, float> PerishableFactorByFoodCategory { get; set; }
Property Value
TransitionableSpeedMulByType
public Dictionary<EnumTransitionType, float> TransitionableSpeedMulByType { get; set; }
Property Value
Methods
Allocate(string)
public void Allocate(string slotId)
Parameters
slotIdstring
DidModifyItemSlot(ItemSlot, ItemStack)
Called when one of the containing slots has been modified
public override void DidModifyItemSlot(ItemSlot slot, ItemStack extractedStack = null)
Parameters
FromTreeAttributes(ITreeAttribute)
Loads the slot contents from given treeAttribute
public override void FromTreeAttributes(ITreeAttribute tree)
Parameters
treeITreeAttribute
GetAutoPullFromSlot(BlockFacing)
Return the slot where a chute may pull items from. Return null if it is now allowed to pull any items from this inventory
public override ItemSlot GetAutoPullFromSlot(BlockFacing atBlockFace)
Parameters
atBlockFaceBlockFacing
Returns
GetAutoPushIntoSlot(BlockFacing, ItemSlot)
Return the slot where a chute may push items into. Return null if it shouldn't move items into this inventory.
public override ItemSlot GetAutoPushIntoSlot(BlockFacing atBlockFace, ItemSlot fromSlot)
Parameters
atBlockFaceBlockFacingfromSlotItemSlot
Returns
GetEnumerator()
Gets the enumerator for the inventory.
public override IEnumerator<ItemSlot> GetEnumerator()
Returns
GetSuitability(ItemSlot, ItemSlot, bool)
How well a stack fits into this inventory. By default 1 for new itemstacks and 3 for an itemstack merge. Chests and other stationary container also add a +1 to the suitability if the source slot is from the players inventory.
public override float GetSuitability(ItemSlot sourceSlot, ItemSlot targetSlot, bool isMerge)
Parameters
Returns
GetTransitionSpeedMul(EnumTransitionType, ItemStack)
Does this inventory speed up or slow down a transition for given itemstack? (Default: 1 for perish and 0 otherwise)
public override float GetTransitionSpeedMul(EnumTransitionType transType, ItemStack stack)
Parameters
transTypeEnumTransitionTypestackItemStack
Returns
NewSlot(string)
Called when initializing the inventory or when loading the contents
protected ItemSlot NewSlot(string slotId)
Parameters
slotIdstring
Returns
ToTreeAttributes(ITreeAttribute)
Stores the slot contents to invtree
public override void ToTreeAttributes(ITreeAttribute invtree)
Parameters
invtreeITreeAttribute