+ // Adds an item to a suitable place. Returns leftover item (possibly empty).
+ ItemStack addItem(const ItemStack &newitem);
+
+ // If possible, adds item to given slot.
+ // If cannot be added at all, returns the item back.
+ // If can be added partly, decremented item is returned back.
+ // If can be added fully, empty item is returned.
+ ItemStack addItem(u32 i, const ItemStack &newitem);
+
+ // Checks whether the item could be added to the given slot
+ // If restitem is non-NULL, it receives the part of newitem that
+ // would be left over after adding.
+ bool itemFits(const u32 i, const ItemStack &newitem,
+ ItemStack *restitem = NULL) const;
+
+ // Checks whether there is room for a given item
+ bool roomForItem(const ItemStack &item) const;
+
+ // Checks whether the given count of the given item
+ // exists in this inventory list.
+ // If match_meta is false, only the items' names are compared.
+ bool containsItem(const ItemStack &item, bool match_meta) const;
+
+ // Removes the given count of the given item name from
+ // this inventory list. Walks the list in reverse order.
+ // If not as many items exist as requested, removes as
+ // many as possible.
+ // Returns the items that were actually removed.
+ ItemStack removeItem(const ItemStack &item);
+
+ // Takes some items from a slot.
+ // If there are not enough, takes as many as it can.
+ // Returns empty item if couldn't take any.
+ ItemStack takeItem(u32 i, u32 takecount);
+
+ // Move an item to a different list (or a different stack in the same list)
+ // count is the maximum number of items to move (0 for everything)
+ // returns number of moved items
+ u32 moveItem(u32 i, InventoryList *dest, u32 dest_i,
+ u32 count = 0, bool swap_if_needed = true, bool *did_swap = NULL);
+
+ // like moveItem, but without a fixed destination index
+ // also with optional rollback recording
+ void moveItemSomewhere(u32 i, InventoryList *dest, u32 count);