def total_stored(self, wanted, slots=None): """ Calculates the total number of items of that type in the current window or given slot range. :param wanted: function(Slot) or Slot or itemID or (itemID, metadata) """ if slots is None: slots = self.window.slots wanted = make_slot_check(wanted) return sum(slot.amount for slot in slots if wanted(slot))
def find_slots(self, 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. :param wanted: function(Slot) or Slot or itemID or (itemID, metadata) """ if slots is None: slots = self.inv_slots_preferred + self.window.window_slots wanted = make_slot_check(wanted) for slot in slots: if wanted(slot): yield slot