Interface ViewableInventory
- All Superinterfaces:
Inventory
,ValueContainer
- All Known Subinterfaces:
BlockEntityInventory<T>
,ViewableInventory.Custom
Interface for inventories which may be interacted with by Players.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A builder for inventories conforming to a ContainerTypestatic interface
A customViewableInventory
created using thebuilder()
-
Method Summary
Modifier and TypeMethodDescriptionasMenu()
Create a newInventoryMenu
based on this ViewableInventory which allows for lightweight callbacks on inventory clicks and changes.static ViewableInventory.Builder
builder()
Creates a newViewableInventory.Builder
to build anViewableInventory
.boolean
canInteractWith
(ServerPlayer player) Gets whether the specifiedplayer
can interact with this object.boolean
Checks for whether this Inventory currently has viewers.viewers()
Gets the currentviewers
looking at this Inventory.Methods inherited from interface org.spongepowered.api.item.inventory.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, union
-
Method Details
-
viewers
Set<ServerPlayer> viewers()Gets the currentviewers
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
Gets whether the specifiedplayer
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 newInventoryMenu
based on this ViewableInventory which allows for lightweight callbacks on inventory clicks and changes. To receive callbacks the inventory must be opened fromInventoryMenu.open(ServerPlayer)
- Returns:
- The new InventoryMenu
-
builder
Creates a newViewableInventory.Builder
to build anViewableInventory
.- Returns:
- The builder
-