Module artisanryui

artisanryui is a static, global object that allows to replace the inventory with the Artisanry one.

Functions

activate (artisanry, formspec_provider, output_size) Activates the ArtinsaryUI.
build_formspec (player, groups) Builds the formspec for the artisanryui inventory.
change_group (player, formname, fields) Callback for when a different group is selected.
create_inventory () Creates a detached inventory that is used.
drop_items (player, formname, fields) Drops all items in the input list if the player closes the inventory screen.
replace_inventories () Replaces the inventory of every currently connected player with the artisanryui one.
replace_inventory (player) Replaces the inventory of the given player with the artisanryui one.
scroll_page (player, formname, fields) Callback for when the scroll buttons are pressed.
update_from_input_inventory (player) Updates from the input inventory of the given player.
update_player_inventory (player, taken_stack) Updates the players inventory based on the taken stack.

Tables

groups The cache what group the player has currently selected.
last_blueprints_cache The last blueprints of the players.
pages The cache what page the players are currently looking at.

Fields

artisanry The Artisanry object that is used.
formspec_provider The provider that provides the formspec for players inventory.
inventory The inventory that is used for the input and output fields.
output_size The size of the output field.


Functions

activate (artisanry, formspec_provider, output_size)
Activates the ArtinsaryUI.

This function replaces all inventories of all currently connected players and also registers a callback to replace the inventory of every new player.

Parameters:

  • artisanry The Artisanry instance to use.
  • formspec_provider Optional. The provider for the formspec that is to replace the inventories of the players. This is a function that accepts the Player object, a List of sorted and unique group names (without nil) and returns the formspec. The important fields for the formspec are a detached inventory with the name "artisanrui" with the lists "PLAYERNAME-input" and "PLAYERNAME-output", as two buttons with the names "artisanryui-next-page" and "artisanryui-previous-page". Also a dropdown or similar with the name "artisanryui-group" which contains the group to display. Can be nil for the default one.
  • output_size Optional. The size of the output field in the custom formspec, as in how many single slots there are. Can be nil for the default value of 35 (7 * 5).
build_formspec (player, groups)
Builds the formspec for the artisanryui inventory.

Parameters:

  • player The player.
  • groups A List of group names.

Returns:

    The formspec for the inventory.
change_group (player, formname, fields)
Callback for when a different group is selected.

Parameters:

  • player The Player object from which the event originated.
  • formname The name of the form.
  • fields The fields.
create_inventory ()
Creates a detached inventory that is used.

Returns:

    The detached inventory.
drop_items (player, formname, fields)
Drops all items in the input list if the player closes the inventory screen.

Parameters:

  • player The Player object.
  • formname The name of the form.
  • fields The fields.
replace_inventories ()
Replaces the inventory of every currently connected player with the artisanryui one.
replace_inventory (player)
Replaces the inventory of the given player with the artisanryui one.

Parameters:

  • player The player for which to replace the inventory.
scroll_page (player, formname, fields)
Callback for when the scroll buttons are pressed.

Parameters:

  • player The Player object from which the event originated.
  • formname The name of the form.
  • fields The fields.
update_from_input_inventory (player)
Updates from the input inventory of the given player.

Parameters:

  • player The player for which to update the inventories.
update_player_inventory (player, taken_stack)
Updates the players inventory based on the taken stack.

Parameters:

  • player The player for which to update the inventories.
  • taken_stack The ItemStack that was taken.

Tables

groups
The cache what group the player has currently selected.
last_blueprints_cache
The last blueprints of the players.
pages
The cache what page the players are currently looking at.

Fields

artisanry
The Artisanry object that is used.
formspec_provider
The provider that provides the formspec for players inventory.
inventory
The inventory that is used for the input and output fields.
output_size
The size of the output field.
generated by LDoc 1.4.2