Interface ViewableInventory
- All Superinterfaces:
Inventory,ValueContainer
- All Known Subinterfaces:
BlockEntityInventory<T>
Interface for inventories which may be interacted with by Players.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for inventories conforming to a ContainerType -
Method Summary
Modifier and TypeMethodDescriptionasMenu()Create a newInventoryMenubased on this ViewableInventory which allows for lightweight callbacks on inventory clicks and changes.static ViewableInventory.Builderbuilder()Creates a newViewableInventory.Builderto build anViewableInventory.booleancanInteractWith(ServerPlayer player) Gets whether the specifiedplayercan interact with this object.booleanChecks for whether this Inventory currently has viewers.viewers()Gets the currentviewerslooking 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 currentviewerslooking 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 specifiedplayercan 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 newInventoryMenubased 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.Builderto build anViewableInventory.- Returns:
- The builder
-