RecipeInventory
classInventory that mirrors the slots of a recipe
- load-only Usable only while mods load. The game seals these members once loading finishes, so a call or a write from a running world raises an error.
Fields
| Name | Type | Description | |
|---|---|---|---|
| recipe | Recipe | ||
Functions
RecipeInventory:add(item, count, data) load-only
Append a recipe slot holding item with count
| item | StaticItem | |
| count | integer | |
| data | RecipeItemData | Slot metadata, nil for a plain slot |
RecipeInventory:clear() load-only
Drop every slot of this recipe side
RecipeInventory:slot(index)
Item and count of a slot, counted from 1
| index | integer | Slot number |
returns ItemData An empty stack when there is no such slot
RecipeInventory:slot_data(index)
Bonus flag, chance and capacity of a slot, counted from 1
| index | integer | Slot number |
returns RecipeItemData Default metadata when there is no such slot
Standard members (4)
These members are available on all classes of this kind.
| RecipeInventory.cast(object) | Trying to cast Object into RecipeInventory |
| RecipeInventory.get_class() | Return RecipeInventory class object |
| RecipeInventory.new(parent, name) | Creates a new RecipeInventory instance |
| RecipeInventory.new_simple() | Creates a new RecipeInventory instance |
Inherited from Inventory (2)
- Inventory:remove_empty_slots() Drop every empty slot from this inventory
- Inventory:resize(size) Set the number of slots; slots past the new number are dropped with what they hold
Inherited from InventoryAccess (6)
- zero_slots Keeps a slot whose count drops to zero
- draggable Whether inventory can be dragged in UI (default: true)
- drop_on_break 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
- InventoryAccess:sub(item, count) Remove item with count from InventoryAccess
- InventoryAccess:add_at(index, item, count) Add item with count into one slot
- InventoryAccess:sub_at(index, item, count) Remove item with count from one slot
Inherited from InventoryReader (3)
- size read-only Number of slots in this InventoryReader
- InventoryReader:get(index) Get ItemData with index from InventoryReader
- InventoryReader:find(item) Looking for index of StaticItem in InventoryReader
Inherited from Instance (1)
- Instance:is_valid() Returns false once the underlying engine object has been destroyed
Inherited from Object (3)
- name read-only Object name
- Object.find(name) Find an already loaded object by name
- Object:get_class() Class of this object
Used by
- Recipe.input field
- Recipe.output field