Table of Contents

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

onNewSlot NewInfSlotDelegate

Fields

OnGetAutoPullFromSlot

public GetAutoPullFromSlotDelegate OnGetAutoPullFromSlot

Field Value

GetAutoPullFromSlotDelegate

OnGetAutoPushIntoSlot

public GetAutoPushIntoSlotDelegate OnGetAutoPushIntoSlot

Field Value

GetAutoPushIntoSlotDelegate

OnGetSuitability

public GetSuitabilityDelegate OnGetSuitability

Field Value

GetSuitabilityDelegate

SlotsByslotId

public OrderedDictionary<string, ItemSlot> SlotsByslotId

Field Value

OrderedDictionary<string, ItemSlot>

Properties

BaseWeight

public float BaseWeight { get; set; }

Property Value

float

Count

Amount of defined slots

public override int Count { get; }

Property Value

int

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

slotId int

Property Value

ItemSlot

this[string]

public ItemSlot this[string slotId] { get; set; }

Parameters

slotId string

Property Value

ItemSlot

PerishableFactorByFoodCategory

public Dictionary<EnumFoodCategory, float> PerishableFactorByFoodCategory { get; set; }

Property Value

Dictionary<EnumFoodCategory, float>

TransitionableSpeedMulByType

public Dictionary<EnumTransitionType, float> TransitionableSpeedMulByType { get; set; }

Property Value

Dictionary<EnumTransitionType, float>

Methods

Allocate(string)

public void Allocate(string slotId)

Parameters

slotId string

DidModifyItemSlot(ItemSlot, ItemStack)

Called when one of the containing slots has been modified

public override void DidModifyItemSlot(ItemSlot slot, ItemStack extractedStack = null)

Parameters

slot ItemSlot
extractedStack ItemStack

If non null the itemstack that was taken out

FromTreeAttributes(ITreeAttribute)

Loads the slot contents from given treeAttribute

public override void FromTreeAttributes(ITreeAttribute tree)

Parameters

tree ITreeAttribute

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

atBlockFace BlockFacing

Returns

ItemSlot

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

atBlockFace BlockFacing
fromSlot ItemSlot

Returns

ItemSlot

GetEnumerator()

Gets the enumerator for the inventory.

public override IEnumerator<ItemSlot> GetEnumerator()

Returns

IEnumerator<ItemSlot>

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

sourceSlot ItemSlot
targetSlot ItemSlot
isMerge bool

Returns

float

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

transType EnumTransitionType
stack ItemStack

Returns

float

NewSlot(string)

Called when initializing the inventory or when loading the contents

protected ItemSlot NewSlot(string slotId)

Parameters

slotId string

Returns

ItemSlot

ToTreeAttributes(ITreeAttribute)

Stores the slot contents to invtree

public override void ToTreeAttributes(ITreeAttribute invtree)

Parameters

invtree ITreeAttribute