Interface InventoryModifier

All Known Implementing Classes:
AnvilInventory, BeaconInventory, BrewingStandInventory, EnchantmentTableInventory, FurnaceInventory, Inventory, PlayerInventory, VillagerInventory

public interface InventoryModifier
Represents an inventory where items can be modified/retrieved.
  • Method Details

    • setItemStack

      void setItemStack​(int slot, @NotNull ItemStack itemStack)
      Sets an ItemStack at the specified slot and send relevant update to the viewer(s).
      Parameters:
      slot - the slot to set the item
      itemStack - the item to set
    • addItemStack

      boolean addItemStack​(@NotNull ItemStack itemStack)
      Adds an ItemStack to the inventory and send relevant update to the viewer(s).

      Even the item cannot be fully added, the amount of itemStack will be updated.

      Parameters:
      itemStack - the item to add
      Returns:
      true if the item has been successfully fully added, false otherwise
    • clear

      void clear()
      Clears the inventory and send relevant update to the viewer(s).
    • getItemStack

      @NotNull ItemStack getItemStack​(int slot)
      Gets the ItemStack at the specified slot.
      Parameters:
      slot - the slot to check
      Returns:
      the item in the slot slot
    • getItemStacks

      @NotNull ItemStack[] getItemStacks()
      Gets all the ItemStack in the inventory.
      Returns:
      an array containing all the inventory's items
    • getSize

      int getSize()
      Gets the size of the inventory.
      Returns:
      the inventory's size
    • getInventoryConditions

      @NotNull java.util.List<InventoryCondition> getInventoryConditions()
      Gets all the InventoryCondition of this inventory.
      Returns:
      a modifiable List containing all the inventory conditions
    • addInventoryCondition

      void addInventoryCondition​(@NotNull InventoryCondition inventoryCondition)
      Adds a new InventoryCondition to this inventory.
      Parameters:
      inventoryCondition - the inventory condition to add