Table of Contents

Interface IHeldBag

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Bag is a non-placed block container, usually one that is attached to an entity

public interface IHeldBag
Extension Methods

Methods

Clear(ItemStack)

Delete all contents of this bag

void Clear(ItemStack bagstack)

Parameters

bagstack ItemStack

GetContents(ItemStack, IWorldAccessor)

Should return all contents of this bag

ItemStack[] GetContents(ItemStack bagstack, IWorldAccessor world)

Parameters

bagstack ItemStack
world IWorldAccessor

Returns

ItemStack[]

GetOrCreateSlots(ItemStack, InventoryBase, int, IWorldAccessor)

List<ItemSlotBagContent> GetOrCreateSlots(ItemStack bagstack, InventoryBase parentinv, int bagIndex, IWorldAccessor world)

Parameters

bagstack ItemStack
parentinv InventoryBase
bagIndex int
world IWorldAccessor

Returns

List<ItemSlotBagContent>

GetQuantitySlots(ItemStack)

Amount of slots this bag provides

int GetQuantitySlots(ItemStack bagstack)

Parameters

bagstack ItemStack

Returns

int

GetSlotBgColor(ItemStack)

The Hex color the bag item slot should take, return null for default

string GetSlotBgColor(ItemStack bagstack)

Parameters

bagstack ItemStack

Returns

string

GetStorageFlags(ItemStack)

The types of items that can be stored in this bag

EnumItemStorageFlags GetStorageFlags(ItemStack bagstack)

Parameters

bagstack ItemStack

Returns

EnumItemStorageFlags

IsEmpty(ItemStack)

Should true if this this bag is empty

bool IsEmpty(ItemStack bagstack)

Parameters

bagstack ItemStack

Returns

bool

Store(ItemStack, ItemSlotBagContent)

Save given itemstack into this bag

void Store(ItemStack bagstack, ItemSlotBagContent slot)

Parameters

bagstack ItemStack
slot ItemSlotBagContent