The fl_inventory panel displays an inventory as a grid of fl_inventory_item slots
and lets the player drag items around.
It is created with Inventory:create_panel and is rebuilt every time the inventory is
synchronized. Dropping an item onto a slot asks the server to move it there; dropping it
onto the parent of the panel asks the server to drop it into the world. Pressing R
rotates the item that is being dragged.
Summary
Methods
Methods
Sets whether the slots display their numbers. The value is stored on the panel under the name of this method, so the method cannot be called on the same panel again.
Parameters
- bool Boolean
Returns the icon that is drawn in the slots of the inventory.
Returns
- String FontAwesome icon id or path to a material, or nil if there is no icon
Returns the inventory that the panel displays.
Returns
- Inventory
Returns the height of the inventory in a number of slots.
Returns
- Number
Returns the id of the inventory that the panel displays.
Returns
- Number
Returns the size of the inventory in a number of slots.
Returns
- Number width
- Number height
Returns the type of the inventory.
Returns
- String
Returns the width of the inventory in a number of slots.
Returns
- Number
Returns the entity that the inventory belongs to.
Returns
- Entity
Returns the instance ids of the items located in the specified slot of the inventory.
Parameters
- x Number
- y Number
Returns
- List<Number> instance ids, or nil if the slot is out of the inventory bounds
Returns the gap between the slots.
Returns
- Number gap in pixels
Returns the size of a single slot.
Returns
- Number size in pixels
Returns the slots grid of the inventory.
Returns
- Map slots, indexed by y and then by x; every slot is an array of instance ids
Creates the scrollable grid of slots and makes it accept dragged items. Items dropped onto the parent panel get dropped into the world.
Checks if the inventory is disabled.
Returns
- Boolean
Checks if the inventory is multislot.
Returns
- Boolean
Handles an item panel being dropped onto the inventory by asking the server to move its items to the hovered slot. Holding CTRL moves half of the stack, SHIFT a single item.
Parameters
- dropped Panel the fl_inventory_item panel that has been dropped
Rotates the item that is being dragged when R is pressed.
Parameters
- key Number KEY_ enumerator
Draws the background of the inventory using the theme.
Parameters
- w Number
- h Number
Draws over the inventory using the theme.
Parameters
- w Number
- h Number
Resizes the scroll panels to fit the grid of slots.
Parameters
- w Number
- h Number
Recreates the slot panels based on the current contents of the inventory. Runs the 'OnInventoryRebuild' hook afterward.
Sets the icon that is drawn in the slots of the inventory.
Parameters
- icon String FontAwesome icon id ('fa-...') or path to a material; nil for no icon
Sets the inventory that the panel displays and rebuilds the panel.
Parameters
- inventory_id Number id of the inventory
Sets the gap between the slots.
Parameters
- padding Number gap in pixels
Sets the size of a single slot.
Parameters
- size Number size in pixels
Resizes the panel so that all slots of the inventory fit in it.
Hides the item panel that is being dragged and puts empty slots in its place.
Parameters
- dropped Panel the fl_inventory_item panel that is being dragged