public interface CraftingGrid extends java.lang.Iterable<Item>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TOPOLOGY_SQUARE |
static java.lang.String |
TYPE_CRAFTING |
| Modifier and Type | Method and Description |
|---|---|
default int |
countFilledStacks()
Counts the number of filled the items in this crafting grid.
|
java.util.Optional<Item> |
getCrafting(int slot)
Gets the item in a specified slot.
|
java.util.Optional<Item> |
getCrafting(int x,
int y)
Gets the item at the given (x, y) position.
|
default java.util.Optional<Item> |
getFirstNonEmptyItem()
Gets the first non-empty item in this crafting grid.
|
default java.util.Optional<org.apache.commons.math3.geometry.euclidean.twod.Vector2D> |
getFirstNonEmptyPosition()
Finds the position of the first non-empty the item in this crafting grid.
|
int |
getHeight()
Gets the height of the crafting grid.
|
java.util.Optional<Player> |
getPlayer()
Represents the player that is currently using this crafting grid.
|
java.lang.String |
getTopology()
Gets the topology of the crafting grid.
|
java.lang.String |
getType()
Gets the type of crafting grid.
|
int |
getWidth()
Gets the width of the crafting grid.
|
default void |
giveBack(Item item)
Gives back a certain item.
|
default java.util.Iterator<Item> |
iterator() |
default java.util.Optional<Item> |
removeCrafting(int slot)
Removes the item in a specified slot.
|
default java.util.Optional<Item> |
removeCrafting(int x,
int y)
Removes the item at the given (x, y) position.
|
boolean |
setCrafting(int x,
int y,
java.util.Optional<Item> item)
Sets the item at the given (x, y) position.
|
boolean |
setCrafting(int slot,
java.util.Optional<Item> item)
Modifies the item in the given slot.
|
int |
size()
Returns the total size of this crafting grid.
|
default java.util.Spliterator<Item> |
spliterator() |
default java.util.stream.Stream<Item> |
stream()
Represents this crafting grid as an
Item Stream |
static final java.lang.String TOPOLOGY_SQUARE
static final java.lang.String TYPE_CRAFTING
java.util.Optional<Player> getPlayer()
int size()
java.util.Optional<Item> getCrafting(int slot)
slot - slot indexgetCrafting(int, int)java.util.Optional<Item> getCrafting(int x, int y)
x - x positiony - y positiongetCrafting(int)boolean setCrafting(int slot,
java.util.Optional<Item> item)
slot - slot to be modifieditem - the item to be setCraftingsetCrafting(int, int, Optional)boolean setCrafting(int x,
int y,
java.util.Optional<Item> item)
x - x positiony - y positionitem - the item to be setCraftingsetCrafting(int, Optional)default java.util.Optional<Item> removeCrafting(int slot)
slot - slot indexremoveCrafting(int, int)default java.util.Optional<Item> removeCrafting(int x, int y)
x - x positiony - y positionremoveCrafting(int)int getWidth()
int getHeight()
default void giveBack(Item item)
item - The Item to give back.java.lang.String getTopology()
TOPOLOGY_SQUARE. Other
kinds of grids may return a different value.java.lang.String getType()
TYPE_CRAFTING. Other
machines or crafting tables (with a separate setCrafting of recipes) may return a different value.default int countFilledStacks()
default java.util.Optional<Item> getFirstNonEmptyItem()
default java.util.Optional<org.apache.commons.math3.geometry.euclidean.twod.Vector2D> getFirstNonEmptyPosition()
default java.util.Iterator<Item> iterator()
iterator in interface java.lang.Iterable<Item>default java.util.Spliterator<Item> spliterator()
spliterator in interface java.lang.Iterable<Item>