Interface Container
- All Superinterfaces:
Inventory, ValueContainer
-
Nested Class Summary
Nested classes/interfaces inherited from interface Inventory
Inventory.Builder -
Method Summary
Modifier and TypeMethodDescriptionReturns theInventoryMenuif this container has been opened by one.cursor()Gets the viewing players cursor item.booleanisOpen()Returns whether this Container is open.booleanisViewedSlot(Slot slot) Returns whether given slot is part of the viewed inventories but not part of the viewers own inventory.booleansetCursor(ItemStackLike item) Sets the viewing players cursor item.type()Returns theContainerTypeof this container.viewed()Returns the list of viewed inventories.viewer()Gets the viewingplayer.Methods inherited from interface Inventory
asViewable, canFit, capacity, children, clear, contains, contains, containsAny, containsChild, containsInventory, freeCapacity, get, get, hasChildren, intersect, offer, offer, parent, peek, peekAt, poll, poll, pollFrom, pollFrom, query, query, query, query, query, query, root, set, slot, slots, totalQuantity, unionMethods inherited from interface ValueContainer
getDouble, getInt, getKeys, getLong, getOrElse, getOrNull, getValue, getValues, require, requireValue, streamKeys, streamValues, supports, supports
-
Method Details
-
isViewedSlot
Returns whether given slot is part of the viewed inventories but not part of the viewers own inventory.Examples for viewed inventory slots:
All the slots of the opened chest and not the player grid below.
The slots of the crafting grid in the opened player inventory.
- Parameters:
slot- The slot to check.- Returns:
truewhen the slot is part of the viewed inventories.
-
viewed
-
setCursor
Sets the viewing players cursor item.Returns false when the container is no longer open.
- Parameters:
item- The item to set.- Returns:
- true if the cursor was set.
-
cursor
Gets the viewing players cursor item.Returns
Optional.empty()when the container was closed.- Returns:
- The players cursor item.
-
viewer
-
isOpen
boolean isOpen()Returns whether this Container is open.- Returns:
- Whether this Container is open.
-
type
Optional<ContainerType> type()Returns theContainerTypeof this container.Notably the players own inventory does not have a ContainerType
- Returns:
- the ContainerType of this container.
-
currentMenu
Optional<InventoryMenu> currentMenu()Returns theInventoryMenuif this container has been opened by one.- Returns:
- the current InventoryMenu if present
-