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
intinvId
stringapi
ICoreAPIonNewSlot
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
Methods
AddPlayerUsage(string, int, int)
public void AddPlayerUsage(string playerUid, int slotId, int value)
Parameters
CanTake(ItemSlot, ItemStackMoveOperation)
public bool CanTake(ItemSlot fromSlot, ItemStackMoveOperation op)
Parameters
fromSlot
ItemSlotop
ItemStackMoveOperation
Returns
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
Returns
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
OnPlacementBySchematic()
public void OnPlacementBySchematic()
ToTreeAttributes(ITreeAttribute)
Stores the slot contents to invtree
public override void ToTreeAttributes(ITreeAttribute invtree)
Parameters
invtree
ITreeAttribute