Inventory

Description

The Inventory plugin keeps track of the inventory and provides simple inventory analysis and manipulation.

Events

Undocumented

Methods and Attributes

class spockbot.plugins.helpers.inventory.InventoryCore(net_plugin, send_click)

Handles operations with the player inventory.

active_slot
click_slot(slot, right=False)

Left-click or right-click the slot.

Parameters:slot (Slot) – The clicked slot. Can be Slot instance or integer. Set to inventory.cursor_slot for clicking outside the window.
close_window()
creative_set_slot(slot_nr=None, slot_dict=None, slot=None)
drop_slot(slot=None, drop_stack=False)

Drop one or all items of the slot.

Does not wait for confirmation from the server. If you want that, use a Task and yield inventory.async.drop_slot() instead.

If slot is None, drops the cursor_slot or, if that’s empty, the currently held item (active_slot).

Parameters:slot (Optional[Slot]) – The dropped slot. Can be None, integer, or Slot instance.
Returns:The action ID of the click
Return type:int
find_slot(wanted, slots=None)

Searches the given slots or, if not given, active hotbar slot, hotbar, inventory, open window in this order.

Parameters:wanted – function(Slot) or Slot or itemID or (itemID, metadata)
Returns:The first slot containing the item or None if not found.
Return type:Optional[Slot]
find_slots(wanted, slots=None)

Yields all slots containing the item. Searches the given slots or, if not given, active hotbar slot, hotbar, inventory, open window in this order.

Parameters:wanted – function(Slot) or Slot or itemID or (itemID, metadata)
inv_slots_preferred

List of all available inventory slots in the preferred search order. Does not include the additional slots from the open window.

  1. active slot
  2. remainder of the hotbar
  3. remainder of the persistent inventory
select_active_slot(slot_or_hotbar_index)
total_stored(wanted, slots=None)

Calculates the total number of items of that type in the current window or given slot range.

Parameters:wanted – function(Slot) or Slot or itemID or (itemID, metadata)