Interface Inventory

All Known Subinterfaces:
AnvilInventory, BarrelInventory, BeaconInventory, BrewingInventory, ChestInventory, ContainerInventory, CraftingGrid, CreatureInventory, EnchantInventory, FurnaceInventory, HopperInventory, PlayerInventory, ShulkerBoxInventory

public interface Inventory
author: MagicDroidX Nukkit Project
  • Field Details

  • Method Details

    • getSize

      int getSize()
    • getMaxStackSize

      int getMaxStackSize()
    • setMaxStackSize

      void setMaxStackSize(int size)
    • getName

      String getName()
    • getTitle

      String getTitle()
    • getItem

      @NonNull ItemStack getItem(int index)
    • setItem

      default boolean setItem(int index, ItemStack item)
    • setItem

      boolean setItem(int index, ItemStack item, boolean send)
    • addItem

      ItemStack[] addItem(ItemStack... slots)
    • canAddItem

      boolean canAddItem(ItemStack item)
    • removeItem

      ItemStack[] removeItem(ItemStack... slots)
    • getContents

      Map<Integer,​ItemStack> getContents()
    • setContents

      void setContents(Map<Integer,​ItemStack> items)
    • sendContents

      default void sendContents(Player player)
    • sendContents

      default void sendContents(Collection<? extends Player> players)
    • sendContents

      void sendContents(Player... players)
    • sendSlot

      default void sendSlot(int index, Player player)
    • sendSlot

      default void sendSlot(int index, Collection<? extends Player> players)
    • sendSlot

      void sendSlot(int index, Player... players)
    • contains

      boolean contains(ItemStack item)
    • all

      Map<Integer,​ItemStack> all(ItemStack item)
    • first

      default int first(ItemStack item)
    • first

      int first(ItemStack item, boolean exact)
      Search for the first occurrence of target item
      Parameters:
      item - target item
      exact - if true the item count will be must match
      Returns:
      the first index containing the item
    • firstFit

      default int firstFit(ItemStack item)
    • firstFit

      int firstFit(ItemStack item, boolean single)
      Returns the first slot where item fits to
      Parameters:
      item - item to search for
      single - if false the item count will be used. Otherwise it'll be 1
      Returns:
      the first slot index that item fits to
    • firstEmpty

      int firstEmpty()
      Search for the first empty slot
      Returns:
      the first slot index
    • firstNonEmpty

      int firstNonEmpty()
      Search for the first slot containing an item
      Returns:
      the first non-empty slot
    • getFreeSpace

      int getFreeSpace(ItemStack item)
      Returns how much space remains for the target item
      Parameters:
      item - target item
      Returns:
      amount if free space
    • decrementCount

      void decrementCount(int slot)
      Decrease item count in the given slot
      Parameters:
      slot - target slot index
    • incrementCount

      void incrementCount(int slot)
      Increase item count in the given slot
      Parameters:
      slot - target slot index
    • remove

      void remove(ItemStack item)
    • clear

      default boolean clear(int index)
    • clear

      boolean clear(int index, boolean send)
    • clearAll

      void clearAll()
    • isFull

      boolean isFull()
    • isEmpty

      boolean isEmpty()
    • getViewers

      Set<? extends Player> getViewers()
    • getType

      @NonNull InventoryType getType()
    • getHolder

      InventoryHolder getHolder()
    • onOpen

      void onOpen(Player who)
    • open

      boolean open(Player who)
    • close

      void close(Player who)
    • onClose

      void onClose(Player who)
    • onSlotChange

      void onSlotChange(int index, ItemStack before, boolean send)