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 interfaceViewableInventory.BuilderA builder for inventories conforming to a ContainerType
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description InventoryMenuasMenu()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.booleanhasViewers()Checks for whether this Inventory currently has viewers.Set<ServerPlayer>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 Detail
-
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
boolean canInteractWith(ServerPlayer player)
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
static ViewableInventory.Builder builder()
Creates a newViewableInventory.Builderto build anViewableInventory.- Returns:
- The builder
-
-