Class Inventory

java.lang.Object
dev.twilite.game.facade.Inventory

public class Inventory extends Object
Inventory accessors backed by the client's inventory data and interface components.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    consume(int... ids)
    Consumes a food or potion item based on its available action (Eat/Drink).
    static boolean
    contains(int... ids)
    Checks if the inventory contains any of the specified items.
    static boolean
    containsAll(int... ids)
    Checks if the inventory contains all of the specified items.
    static int
    count(int... ids)
    Returns the total stack size of an item in the inventory.
    static boolean
    Returns if the inventory is empty.
    static int
    Returns the number of empty slots in the inventory.
    static boolean
    Returns if the inventory is full.
    static Optional<Item>
    item(int... ids)
    Returns an Optional containing the first matching item from the inventory.
    static ItemView
    Returns a lazy view over carried inventory items.
    static ItemView
    items(int componentId)
    Returns a lazy view over inventory items using a custom item component.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Inventory

      public Inventory()
  • Method Details

    • items

      public static ItemView items()
      Returns a lazy view over carried inventory items.
    • items

      public static ItemView items(int componentId)
      Returns a lazy view over inventory items using a custom item component.
      Parameters:
      componentId - packed interface component id from InterfaceId
    • full

      public static boolean full()
      Returns if the inventory is full.
    • empty

      public static boolean empty()
      Returns if the inventory is empty.
    • emptySlots

      public static int emptySlots()
      Returns the number of empty slots in the inventory.
    • item

      public static Optional<Item> item(int... ids)
      Returns an Optional containing the first matching item from the inventory.
      Parameters:
      ids - item ids, usually from ItemId
    • contains

      public static boolean contains(int... ids)
      Checks if the inventory contains any of the specified items.
      Parameters:
      ids - item ids, usually from ItemId
    • containsAll

      public static boolean containsAll(int... ids)
      Checks if the inventory contains all of the specified items.
      Parameters:
      ids - item ids, usually from ItemId
      Returns:
      true if all items are present, otherwise false
    • count

      public static int count(int... ids)
      Returns the total stack size of an item in the inventory.
      Parameters:
      ids - item ids, usually from ItemId
    • consume

      public static void consume(int... ids)
      Consumes a food or potion item based on its available action (Eat/Drink).
      Parameters:
      ids - item ids, usually from ItemId