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.Inventory.Builder
Modifier and Type | Method and Description |
---|---|
Optional<InventoryColumn> |
getColumn(int x)
Gets 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)
Gets the row at the specified index.
|
int |
getRows()
Gets the number of rows in the inventory.
|
Optional<Slot> |
getSlot(int x,
int y)
Gets the
Slot at the specified position. |
Optional<ItemStack> |
peek(int x,
int y)
Gets without removing the stack at the supplied position in this
Inventory.
|
Optional<ItemStack> |
peek(int x,
int y,
int limit)
Gets without removing the stack at the supplied position in this
Inventory.
|
Optional<ItemStack> |
poll(int x,
int y)
Gets and remove the stack at the supplied position in this Inventory.
|
Optional<ItemStack> |
poll(int x,
int y,
int limit)
Gets and remove the stack at the supplied position in this Inventory.
|
InventoryTransactionResult |
set(int x,
int y,
ItemStack stack)
Sets the item in the specified slot.
|
getSlot, peek, peek, poll, poll, set
getSlot, peek, peek, poll, poll, set
builder, canFit, capacity, clear, contains, contains, containsAny, containsInventory, first, getArchetype, getInventoryProperty, getInventoryProperty, getMaxStackSize, getPlugin, getProperties, getProperties, getProperty, getProperty, hasChildren, intersect, next, offer, parent, peek, peek, poll, poll, query, query, query, query, query, query, query, queryAny, root, set, setMaxStackSize, size, slots, totalItems, transform, union
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()
InventoryTransactionResult 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