Item Packer
class ItemPacker
After discovery phase (find all items, group them by their type, sort them by usefulness), this class tries to fit the given requirements (max blocks, required stack cound, etc.) and packs the given items in their target slots.
Items that were deemed useful can be found in usefulItems.
Types
Link copied to clipboard
interface ItemAmountConstraintProvider
Functions
Link copied to clipboard
fun packItems(itemsToFillIn: List<ItemFacet>, hotbarSlotsToFill: List<ItemSlot>?, forbiddenSlots: Set<ItemSlot>, forbiddenSlotsToFill: Set<ItemSlot>, constraintProvider: ItemPacker.ItemAmountConstraintProvider): List<InventorySwap>
Takes items from the itemsToFillIn list until it has collected maxItemCount items and requiredStackCount stacks. The items are marked as useful and fill in hotbar slots if there are still slots to fill.