Class ItemSlotPerPlayer
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public class ItemSlotPerPlayer : ItemSlot
- Inheritance
-
ItemSlotPerPlayer
- Inherited Members
- Extension Methods
Constructors
ItemSlotPerPlayer(InventoryBase, int)
public ItemSlotPerPlayer(InventoryBase inventory, int slotid)
Parameters
inventoryInventoryBaseslotidint
Fields
Slotid
public int Slotid
Field Value
Properties
DrawUnavailable
public override bool DrawUnavailable { get; set; }
Property Value
Inventory
public InventoryPerPlayer Inventory { get; }
Property Value
Methods
ActivateSlot(ItemSlot, ref ItemStackMoveOperation)
Called when a player has clicked on this slot. The source slot is the mouse cursor slot. This handles the logic of either taking, putting or exchanging items.
public override void ActivateSlot(ItemSlot sourceSlot, ref ItemStackMoveOperation op)
Parameters
sourceSlotItemSlotopItemStackMoveOperation
ActivateSlotLeftClick(ItemSlot, ref ItemStackMoveOperation)
Activates the left click functions of the given slot.
protected override void ActivateSlotLeftClick(ItemSlot sinkSlot, ref ItemStackMoveOperation op)
Parameters
sinkSlotItemSlotopItemStackMoveOperation
ActivateSlotRightClick(ItemSlot, ref ItemStackMoveOperation)
Activates the right click functions of the given slot.
protected override void ActivateSlotRightClick(ItemSlot sourceSlot, ref ItemStackMoveOperation op)
Parameters
sourceSlotItemSlotopItemStackMoveOperation
CanHold(ItemSlot)
Whether or not this slot can hold the item from the source slot.
public override bool CanHold(ItemSlot sourceSlot)
Parameters
sourceSlotItemSlot
Returns
CanTake()
Whether or not this slots item can be retrieved.
public override bool CanTake()
Returns
CanTakeFrom(ItemSlot, EnumMergePriority)
Whether or not this slot can take the item from the source slot.
public override bool CanTakeFrom(ItemSlot sourceSlot, EnumMergePriority priority = EnumMergePriority.AutoMerge)
Parameters
sourceSlotItemSlotpriorityEnumMergePriority
Returns
FlipWith(ItemSlot)
Forces a flip with the given ItemSlot
protected override void FlipWith(ItemSlot withslot)
Parameters
withslotItemSlot
TakeOut(int)
Gets some of the contents of the stack.
public override ItemStack? TakeOut(int quantity)
Parameters
quantityintThe amount to get from the stack.
Returns
- ItemStack
The stack with the quantity take out (or as much as was available)
TakeOutWhole()
Gets the entire contents of the stack, setting the base stack to null.
public override ItemStack? TakeOutWhole()
Returns
TryFlipWith(ItemSlot)
Attempts to flip the ItemSlots.
public override bool TryFlipWith(ItemSlot itemSlot)
Parameters
itemSlotItemSlot
Returns
- bool
Whether or no the flip was successful.
TryPutInto(IWorldAccessor, ItemSlot, int)
Attempts to place item in this slot into the target slot.
public override int TryPutInto(IWorldAccessor world, ItemSlot sinkSlot, int quantity = 1)
Parameters
worldIWorldAccessorsinkSlotItemSlotquantityint
Returns
- int
Amount of moved items
TryPutInto(ItemSlot, ref ItemStackMoveOperation)
Returns the quantity of items that were not merged (left over in the source slot)
public override int TryPutInto(ItemSlot sinkSlot, ref ItemStackMoveOperation op)
Parameters
sinkSlotItemSlotopItemStackMoveOperation
Returns
- int
Amount of moved items