Class Equipment

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

public class Equipment extends Object
Provides queries and interactions for items currently worn by the local player.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    allWorn(int... ids)
    Checks if all of the specified items are equipped.
    static int
    count(int id)
    Returns the total stack size of an equipped item (useful for ammo/arrows).
    static Optional<Item>
    item(int... ids)
    Returns an Optional containing the first equipped item matching any of the specified IDs.
    static Optional<Item>
    Returns the item currently equipped in the specified slot.
    static ItemView
    Returns a lazy view over carried equipment items.
    static void
    unequip(int... ids)
    Unequips all currently worn items matching any of the specified IDs.
    static void
    Unequips the currently worn item in each specified slot.
    static boolean
    worn(int... ids)
    Checks if any of the specified items are currently equipped.

    Methods inherited from class java.lang.Object

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

    • Equipment

      public Equipment()
  • Method Details

    • items

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

      public static boolean worn(int... ids)
      Checks if any of the specified items are currently equipped.
      Parameters:
      ids - item ids to check, usually from ItemId
      Returns:
      true if at least one of the specified items is equipped, otherwise false
    • allWorn

      public static boolean allWorn(int... ids)
      Checks if all of the specified items are equipped.
      Parameters:
      ids - item ids to check
      Returns:
      true if all items are equipped, otherwise false
    • count

      public static int count(int id)
      Returns the total stack size of an equipped item (useful for ammo/arrows).
      Parameters:
      id - item id to count, usually from ItemId
      Returns:
      the total stack size of the matching equipped item
    • item

      public static Optional<Item> item(int... ids)
      Returns an Optional containing the first equipped item matching any of the specified IDs.
      Parameters:
      ids - item ids to find, usually from ItemId
      Returns:
      an Optional containing the first matching item if found, otherwise empty
    • item

      public static Optional<Item> item(EquipmentSlot slot)
      Returns the item currently equipped in the specified slot.
      Parameters:
      slot - equipment slot to inspect
      Returns:
      an Optional containing the equipped item if the slot is occupied
    • unequip

      public static void unequip(int... ids)
      Unequips all currently worn items matching any of the specified IDs.
      Parameters:
      ids - item ids to unequip, usually from ItemId
    • unequip

      public static void unequip(EquipmentSlot... slots)
      Unequips the currently worn item in each specified slot.
      Parameters:
      slots - equipment slots to unequip