Search in sources :

Example 1 with InventoryItemComparator

use of com.lilithsthrone.utils.InventoryItemComparator in project liliths-throne-public by Innoxia.

the class CharacterInventory method recalculateMapOfDuplicateItems.

private void recalculateMapOfDuplicateItems() {
    itemDuplicates.clear();
    itemsInInventory.sort(new InventoryItemComparator());
    for (AbstractItem item : itemsInInventory) {
        if (!itemDuplicates.containsKey(item))
            itemDuplicates.put(item, 1);
        else
            itemDuplicates.put(item, itemDuplicates.get(item) + 1);
    }
}
Also used : InventoryItemComparator(com.lilithsthrone.utils.InventoryItemComparator) AbstractItem(com.lilithsthrone.game.inventory.item.AbstractItem)

Aggregations

AbstractItem (com.lilithsthrone.game.inventory.item.AbstractItem)1 InventoryItemComparator (com.lilithsthrone.utils.InventoryItemComparator)1