Interface Inventory2D
-
- All Superinterfaces:
Inventory
,ValueContainer
- All Known Subinterfaces:
GridInventory
,Hotbar
,InventoryColumn
,InventoryRow
public interface Inventory2D extends Inventory
Base interface for inventories with slots obtainable via SlotPos queries.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.item.inventory.Inventory
Inventory.Builder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Optional<ItemStack>
peek(Vector2i pos)
Gets without removing the stack at the supplied position in this Inventory.default InventoryTransactionResult.Poll
poll(Vector2i pos)
Gets and remove the stack at the supplied position in this Inventory.default InventoryTransactionResult.Poll
poll(Vector2i pos, int limit)
Gets and remove the stack at the supplied position in this Inventory.default InventoryTransactionResult
set(Vector2i pos, ItemStack stack)
Sets the item in the specified slot.Optional<Slot>
slot(Vector2i pos)
Gets theSlot
at the specified position.-
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
-
poll
default InventoryTransactionResult.Poll poll(Vector2i pos)
Gets and remove the stack at the supplied position in this Inventory.- Parameters:
pos
- Slot position to query- Returns:
- matching stacks, as per the semantics of
Inventory.poll()
- See Also:
Inventory.poll()
-
poll
default InventoryTransactionResult.Poll poll(Vector2i pos, int limit)
Gets and remove the stack at the supplied position in this Inventory.- Parameters:
pos
- Slot position to querylimit
- item limit- Returns:
- matching stacks, as per the semantics of
Inventory.poll()
- See Also:
Inventory.poll()
-
peek
default Optional<ItemStack> peek(Vector2i pos)
Gets without removing the stack at the supplied position in this Inventory.- Parameters:
pos
- Slot position to query- Returns:
- matching stacks, as per the semantics of
Inventory.peek()
- See Also:
Inventory.peek()
-
set
default InventoryTransactionResult set(Vector2i pos, ItemStack stack)
Sets the item in the specified slot.- Parameters:
pos
- Slot position to setstack
- Stack to insert- Returns:
- matching stacks, as per the semantics of
Inventory.set(int, org.spongepowered.api.item.inventory.ItemStack)
- See Also:
Slot.set(ItemStack)
-
slot
Optional<Slot> slot(Vector2i pos)
Gets theSlot
at the specified position.- Parameters:
pos
- Slot position to retrieve- Returns:
- slot at the specified position, or
Optional.empty()
if no matching slot
-
-