Inventory

Management of items in an inventory, such as a player’s inventory or a chest.

An Inventory object is not created directly. It is accessed through the inventory property of other objects, like Player or a container Node.

class miney.Inventory(luanti: Luanti, parent: object)[source]

Inventories are places to store items, like Chests or player inventories.

add(item: str, amount: int = 1) None[source]

Add an item to an inventory. Possible items can be obtained from type.

Parameters:
  • item – item type

  • amount – item amount

Returns:

None

get_list(name: str = 'main') list[str | None][source]

Get the content of an inventory list.

Parameters:

name – The name of the list to get (e.g., “main”).

Returns:

A list of item strings. Empty slots are represented by None.

get_lists() list[str][source]

Get the names of all available inventory lists.

Returns:

A list of inventory list names (e.g., [“main”, “craft”]).

remove(item: str, amount: int = 1) None[source]

Remove an item from an inventory. Possible items can be obtained from lt.nodes.names.

Parameters:
  • item – item type

  • amount – item amount

Returns:

None