Class InventoryLoadout

java.lang.Object
dev.twilite.game.loadout.InventoryLoadout
All Implemented Interfaces:
Iterable<LoadoutItem>

public class InventoryLoadout extends Object implements Iterable<LoadoutItem>
Item-id based inventory loadout.
  • Constructor Details

    • InventoryLoadout

      public InventoryLoadout()
  • Method Details

    • create

      public static InventoryLoadout create()
      Creates an empty inventory loadout.
    • add

      public InventoryLoadout add(LoadoutItem item)
      Adds an item entry.
    • add

      public InventoryLoadout add(int id)
      Adds a required item by id with an amount of 1.
    • missing

      public List<LoadoutItem> missing()
      Returns missing required entries.
    • excess

      public List<LoadoutItem> excess()
      Returns entries carried above their requested amount.
    • foreign

      public List<Item> foreign()
      Returns carried inventory items that are not part of this loadout.
    • fulfilled

      public boolean fulfilled()
      Returns whether all required entries are currently carried.
    • fulfilled

      public boolean fulfilled(boolean allowForeign)
      Returns whether all required entries are currently carried.
      Parameters:
      allowForeign - if foreign items are allowed in the loadout
    • usedSlots

      public int usedSlots()
      Returns the requested inventory slots.
    • empty

      public boolean empty()
      Returns whether no entries have been added.
    • items

      public Collection<LoadoutItem> items()
      Returns the entries in insertion order.
    • depletionListener

      public ItemDepletionListener depletionListener()
      Returns the item depletion listener.
    • depletionListener

      public InventoryLoadout depletionListener(ItemDepletionListener depletionListener)
      Sets the item depletion listener.
    • iterator

      public Iterator<LoadoutItem> iterator()
      Specified by:
      iterator in interface Iterable<LoadoutItem>