Table of Contents

Class InventoryPerPlayer

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll
public class InventoryPerPlayer : InventoryGeneric, IInventory, IReadOnlyCollection<ItemSlot>, IEnumerable<ItemSlot>, IEnumerable
Inheritance
InventoryPerPlayer
Implements
Inherited Members
Extension Methods

Constructors

InventoryPerPlayer(int, string?, ICoreAPI?, NewSlotDelegate?)

public InventoryPerPlayer(int quantitySlots, string? invId, ICoreAPI? api, NewSlotDelegate? onNewSlot = null)

Parameters

quantitySlots int
invId string
api ICoreAPI
onNewSlot NewSlotDelegate

Fields

PlayerQuantities

public Dictionary<string, int[]> PlayerQuantities

Field Value

Dictionary<string, int[]>

Quantities

public int[] Quantities

Field Value

int[]

Properties

PutLocked

Called by item slot, if true, player cannot put items into this inventory

public override bool PutLocked { get; set; }

Property Value

bool

Methods

AddPlayerUsage(string, int, int)

public void AddPlayerUsage(string playerUid, int slotId, int value)

Parameters

playerUid string
slotId int
value int

CanTake(ItemSlot, ItemStackMoveOperation)

public bool CanTake(ItemSlot fromSlot, ItemStackMoveOperation op)

Parameters

fromSlot ItemSlot
op ItemStackMoveOperation

Returns

bool

FromTreeAttributes(ITreeAttribute)

Loads the slot contents from given treeAttribute

public override void FromTreeAttributes(ITreeAttribute treeAttribute)

Parameters

treeAttribute ITreeAttribute

GetPlayerRemaining(string, int)

public int GetPlayerRemaining(string playerUid, int slotId)

Parameters

playerUid string
slotId int

Returns

int

MarkDirty()

allow the server to resend changed PlayerQuantities

public void MarkDirty()

MarkSlotDirty(int)

Server Side: Will resent the slot contents to the client and mark them dirty there as well Client Side: Will refresh stack size, model and stuff if this stack is currently being rendered

public override void MarkSlotDirty(int slotId)

Parameters

slotId int

NewSlot(int)

Called when initializing the inventory or when loading the contents

protected override ItemSlot NewSlot(int slotId)

Parameters

slotId int

Returns

ItemSlot

OnPlacementBySchematic()

public void OnPlacementBySchematic()

ToTreeAttributes(ITreeAttribute)

Stores the slot contents to invtree

public override void ToTreeAttributes(ITreeAttribute invtree)

Parameters

invtree ITreeAttribute