Interface ItemContainer

  • All Superinterfaces:
    Node

    public interface ItemContainer
    extends Node
    Represents an inventory that contains items.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean contains​(int itemId)
      Check if this item container contains the given item
      int count()
      Get the total number of filled slots in the item container.
      int count​(int itemId)
      Counts how many of an item this item container contains
      int getId()
      Get the item container id
      Item getItem​(int slot)
      Gets an item from the container at the given slot.
      Item[] getItems()
      Gets an array of all items in the container.
      int size()
      Get the number of slots in this item container.
    • Method Detail

      • getId

        int getId()
        Get the item container id
        Returns:
        See Also:
        InventoryID
      • getItems

        @Nonnull
        Item[] getItems()
        Gets an array of all items in the container.
        Returns:
        the items held
      • getItem

        @Nullable
        Item getItem​(int slot)
        Gets an item from the container at the given slot.
        Parameters:
        slot -
        Returns:
        the item
        See Also:
        Item
      • contains

        boolean contains​(int itemId)
        Check if this item container contains the given item
        Parameters:
        itemId -
        Returns:
        See Also:
        ItemID
      • count

        int count​(int itemId)
        Counts how many of an item this item container contains
        Parameters:
        itemId -
        Returns:
        See Also:
        ItemID
      • size

        int size()
        Get the number of slots in this item container. This includes empty slots. For example for the player inventory it can be 28 even with no items in the inventory.
        Returns:
        See Also:
        to get the number of filled slots instead
      • count

        int count()
        Get the total number of filled slots in the item container.
        Returns: