InventoryAccess

InventoryAccess

class

Inventory interface with add and remove operations

Fields

NameTypeDescription
zero_slots boolean Keeps a slot whose count drops to zero
draggable boolean Whether inventory can be dragged in UI (default: true)
drop_on_break boolean Whether what it holds goes to the player when the block is broken or replaced (default: true); false for a slot that only shows something

Functions

InventoryAccess:add(item, count)

Add item with count to InventoryAccess

item StaticItem
count integer

returns integer Remainder

InventoryAccess:sub(item, count)

Remove item with count from InventoryAccess

item StaticItem
count integer

returns integer Remainder

InventoryAccess:add_at(index, item, count)

Add item with count into one slot

index integer Slot index from 0, as get takes it
item StaticItem
count integer

returns integer Remainder, all of count when there is no such slot

InventoryAccess:sub_at(index, item, count)

Remove item with count from one slot

index integer Slot index from 0, as get takes it
item StaticItem
count integer

returns integer Remainder, all of count when there is no such slot or it holds another item

Standard members (2)

These members are available on all classes of this kind.

InventoryAccess.cast(object) Trying to cast Object into InventoryAccess
InventoryAccess.get_class() Return InventoryAccess class object
Inherited from InventoryReader (3)
Inherited from Instance (1)
Inherited from Object (3)

Subclasses

Used by