public interface GridInventory extends Inventory2D
Inventory
which is ordered into a coherent grid format, meaning that its slots can be
referred to by X-Y coordinates as well as single indices.Modifier and Type | Method and Description |
---|---|
Optional<InventoryColumn> |
getColumn(int x)
Get the column at the specified index.
|
int |
getColumns()
Gets the number of columns in the inventory.
|
com.flowpowered.math.vector.Vector2i |
getDimensions()
Returns the dimensions of this GridInventory as a
Vector2i . |
Optional<InventoryRow> |
getRow(int y)
Get the row at the specified index.
|
int |
getRows()
Gets the number of rows in the inventory.
|
Optional<Slot> |
getSlot(int x,
int y)
Get the
Slot at the specified position. |
Optional<ItemStack> |
peek(int x,
int y)
Get without removing the stack at the supplied position in this
Inventory.
|
Optional<ItemStack> |
peek(int x,
int y,
int limit)
Get without removing the stack at the supplied position in this
Inventory.
|
Optional<ItemStack> |
poll(int x,
int y)
Get and remove the stack at the supplied position in this Inventory.
|
Optional<ItemStack> |
poll(int x,
int y,
int limit)
Get and remove the stack at the supplied position in this Inventory.
|
InventoryOperationResult |
set(int x,
int y,
ItemStack stack)
Set the item in the specified slot.
|
getSlot, peek, peek, poll, poll, set
getSlot, peek, peek, poll, poll, set
capacity, clear, contains, contains, first, getMaxStackSize, getProperties, getProperties, getProperty, getProperty, isEmpty, next, offer, parent, peek, peek, poll, poll, query, query, query, query, query, query, query, set, setMaxStackSize, size, slots, totalItems
forEach, iterator, spliterator
int getColumns()
int getRows()
com.flowpowered.math.vector.Vector2i getDimensions()
Vector2i
.Optional<ItemStack> poll(int x, int y)
x
- x coordinatey
- y coordinateOptional.empty()
if the slot is empty or out of boundsInventory.poll()
Optional<ItemStack> poll(int x, int y, int limit)
x
- x coordinatey
- y coordinatelimit
- item limitOptional.empty()
if the slot is empty or out of boundsInventory.poll()
Optional<ItemStack> peek(int x, int y)
x
- x coordinatey
- y coordinateOptional.empty()
if the slot is empty or out of boundsInventory.peek()
Optional<ItemStack> peek(int x, int y, int limit)
x
- x coordinatey
- y coordinatelimit
- item limitOptional.empty()
if the slot is empty or out of boundsInventory.peek()
InventoryOperationResult set(int x, int y, ItemStack stack)
x
- x coordinatey
- y coordinatestack
- Item stack to insertInventory.set(ItemStack)
Optional<Slot> getSlot(int x, int y)
Slot
at the specified position.x
- x coordinatey
- y coordinateSlot
at the specified position or
Optional.empty()
if the coordinates are out of boundsOptional<InventoryRow> getRow(int y)
y
- y coordinateInventoryRow
at the specified position or
Optional.empty()
if the specified row is out of boundsOptional<InventoryColumn> getColumn(int x)
x
- x coordinateInventoryColumn
at the specified position or
Optional.empty()
if the specified column is out of bounds