Table of Contents

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

inventory InventoryBase
slotid int

Fields

Slotid

public int Slotid

Field Value

int

Properties

DrawUnavailable

public override bool DrawUnavailable { get; set; }

Property Value

bool

Inventory

public InventoryPerPlayer Inventory { get; }

Property Value

InventoryPerPlayer

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

sourceSlot ItemSlot
op ItemStackMoveOperation

ActivateSlotLeftClick(ItemSlot, ref ItemStackMoveOperation)

Activates the left click functions of the given slot.

protected override void ActivateSlotLeftClick(ItemSlot sinkSlot, ref ItemStackMoveOperation op)

Parameters

sinkSlot ItemSlot
op ItemStackMoveOperation

ActivateSlotRightClick(ItemSlot, ref ItemStackMoveOperation)

Activates the right click functions of the given slot.

protected override void ActivateSlotRightClick(ItemSlot sourceSlot, ref ItemStackMoveOperation op)

Parameters

sourceSlot ItemSlot
op ItemStackMoveOperation

CanHold(ItemSlot)

Whether or not this slot can hold the item from the source slot.

public override bool CanHold(ItemSlot sourceSlot)

Parameters

sourceSlot ItemSlot

Returns

bool

CanTake()

Whether or not this slots item can be retrieved.

public override bool CanTake()

Returns

bool

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

sourceSlot ItemSlot
priority EnumMergePriority

Returns

bool

FlipWith(ItemSlot)

Forces a flip with the given ItemSlot

protected override void FlipWith(ItemSlot withslot)

Parameters

withslot ItemSlot

TakeOut(int)

Gets some of the contents of the stack.

public override ItemStack? TakeOut(int quantity)

Parameters

quantity int

The 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

ItemStack

TryFlipWith(ItemSlot)

Attempts to flip the ItemSlots.

public override bool TryFlipWith(ItemSlot itemSlot)

Parameters

itemSlot ItemSlot

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

world IWorldAccessor
sinkSlot ItemSlot
quantity int

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

sinkSlot ItemSlot
op ItemStackMoveOperation

Returns

int

Amount of moved items