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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ViewableInventory.Builder
A builder for inventories conforming to a ContainerType
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description InventoryMenu
asMenu()
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
hasViewers()
Checks for whether this Inventory currently has viewers.Set<ServerPlayer>
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 Detail
-
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
boolean canInteractWith(ServerPlayer player)
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
static ViewableInventory.Builder builder()
Creates a newViewableInventory.Builder
to build anViewableInventory
.- Returns:
- The builder
-
-