Interface ViewableInventory

All Superinterfaces:
Inventory, ValueContainer
All Known Subinterfaces:
BlockEntityInventory<T>

public interface ViewableInventory extends Inventory
Interface for inventories which may be interacted with by Players.
  • Method Details

    • viewers

      Set<ServerPlayer> viewers()
      Gets the current viewers looking at this Inventory.
      Returns:
      The current viewers of this inventory
    • hasViewers

      boolean hasViewers()
      Checks for whether this Inventory currently has viewers.
      Returns:
      True if viewers are currently looking at this inventory
    • canInteractWith

      boolean canInteractWith(ServerPlayer player)
      Gets whether the specified player can interact with this object.
      Parameters:
      player - the Player wishing to interact with this Inventory
      Returns:
      true if the Entity is able to interact with this Inventory
    • asMenu

      InventoryMenu asMenu()
      Create a new InventoryMenu based on this ViewableInventory which allows for lightweight callbacks on inventory clicks and changes. To receive callbacks the inventory must be opened from InventoryMenu.open(ServerPlayer)
      Returns:
      The new InventoryMenu
    • builder

      static ViewableInventory.Builder builder()
      Creates a new ViewableInventory.Builder to build an ViewableInventory.
      Returns:
      The builder