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
InventoryBasePlayer(string, ICoreAPI)
public InventoryBasePlayer(string inventoryID, ICoreAPI api)
Parameters
Fields
playerUID
The player ID for the inventory.
protected string playerUID
Field Value
Properties
Owner
public Entity Owner { get; }
Property Value
Player
The owning player of this inventory
public IPlayer Player { get; }
Property Value
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
Methods
CanPlayerAccess(IPlayer, EntityPos)
Determines whether or not the player can access the invnetory.
public override bool CanPlayerAccess(IPlayer player, EntityPos position)
Parameters
Returns
DropAll(Vec3d, int)
Drops the contents of all the slots into the world.
public override void DropAll(Vec3d pos, int maxStackSize = 0)
Parameters
pos
Vec3dWhere to drop all this stuff.
maxStackSize
intIf 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
spawnItemEntity(ItemStack, Vec3d, int)
protected void spawnItemEntity(ItemStack itemstack, Vec3d pos, int despawnSeconds)