Table of Contents

Class InventoryBasePlayer

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Abstract class used for all inventories that are "on" the player. Any inventory not inheriting from this class will not be stored to the savegame as part of the players inventory.

public abstract class InventoryBasePlayer : InventoryBase, IInventory, IReadOnlyCollection<ItemSlot>, IEnumerable<ItemSlot>, IEnumerable, IOwnedInventory
Inheritance
InventoryBasePlayer
Implements
Inherited Members
Extension Methods

Constructors

InventoryBasePlayer(string, string, ICoreAPI)

public InventoryBasePlayer(string className, string playerUID, ICoreAPI api)

Parameters

className string
playerUID string
api ICoreAPI

InventoryBasePlayer(string, ICoreAPI)

public InventoryBasePlayer(string inventoryID, ICoreAPI api)

Parameters

inventoryID string
api ICoreAPI

Fields

playerUID

The player ID for the inventory.

protected string playerUID

Field Value

string

Properties

Owner

public Entity Owner { get; }

Property Value

Entity

Player

The owning player of this inventory

public IPlayer Player { get; }

Property Value

IPlayer

RemoveOnClose

If true, the inventory will be removed from the list of available inventories once closed (i.e. is not a personal inventory that the player carries with him)

public override bool RemoveOnClose { get; }

Property Value

bool

Methods

CanPlayerAccess(IPlayer, EntityPos)

Determines whether or not the player can access the invnetory.

public override bool CanPlayerAccess(IPlayer player, EntityPos position)

Parameters

player IPlayer

The player attempting access.

position EntityPos

The postion of the entity.

Returns

bool

DropAll(Vec3d, int)

Drops the contents of all the slots into the world.

public override void DropAll(Vec3d pos, int maxStackSize = 0)

Parameters

pos Vec3d

Where to drop all this stuff.

maxStackSize int

If non-zero, will split up the stacks into stacks of give max stack size

HasOpened(IPlayer)

Checks if given player has this inventory currently opened

public override bool HasOpened(IPlayer player)

Parameters

player IPlayer

Returns

bool

spawnItemEntity(ItemStack, Vec3d, int)

protected void spawnItemEntity(ItemStack itemstack, Vec3d pos, int despawnSeconds)

Parameters

itemstack ItemStack
pos Vec3d
despawnSeconds int