ef5ac1d818
[creative_inventory] Now has a search bar!
2.2 KiB
2.2 KiB
Lua API: Inventory Widget
Example
gui:inventory {
name = "inv_main", -- mandatory field
pos = {x = 7, y = 83}, -- mandatory field
inventory = {
source = "player",
player = "player",
inventory_name = "main",
offset = 9,
count = 9 * 3,
},
size = {x = 9, y = 3},
shift_destination = "inv_hotbar,inv_main",
}
Attributes
filter
Use a group as a filter for this inventory widget.
Example:
filter = "group:om_fuel"
inventory
Details of the inventory to use.
Example:
inventory = {
source = "block",
block = {x = 0, y = 10, z = 20},
offset = 1,
count = 1,
}
-- or
inventory = {
source = "player",
player = "player",
inventory_name = "main",
offset = 9,
count = 9 * 3,
}
-- or
inventory = {
source = "temp",
inventory_name = "inv_data",
count = 9 * 5,
}
block
Specify the block to use with block
inventory source.
block = {
x = 0,
y = 0,
z = 0
}
count
Size of the subset of the source inventory.
Example:
count = 27
inventory_name
Specify the inventory to use. Used with player
and temp
inventory sources.
Example:
inventory_name = "main"
offset
Offset of the subset of the target inventory.
Example:
offset = 0 -- this is the default value
player
Note: Placeholder. Currently unused.
Example:
player = "player"
source
Source of the inventory displayed.
Example:
source = "player"
Possible values:
player
: Set a specific player as the sourceblock
: Set a specific block as the sourcetemp
: Set a temporary inventory as the source
is_read_only
Defines if the inventory is read-only or not.
Example:
is_read_only = false -- this is the default value
name
Name of the widget. Mandatory field.
Example:
name = "inv_main"
pos
Position of the widget. Mandatory field.
Example:
pos = {
x = 0,
y = 0
}
shift_destination
Names of the inventories used for the Shift+Click action, separated by ,
Example:
shift_destination = "inv_hotbar,inv_main"
size
Size of the inventory (in slots).
Example:
size = {
x = 9,
y = 3
}