Interface CraftingInput
The contents of a crafting grid, row by row from the top-left corner.
The grid of the player inventory is 2×2, the one of a crafting table 3×3. Empty slots hold
ItemStack.EMPTY. Instances are immutable snapshots.
- Since:
- 0.1.0
-
Method Summary
-
Method Details
-
of
- Parameters:
width- the number of columnsheight- the number of rowsitems-width * heightstacks, row-major- Returns:
- a snapshot of that grid, to match or test against
- Throws:
IllegalArgumentException- if the grid is smaller than 1×1 oritemshas the wrong size- Since:
- 0.1.0
-
width
int width()- Returns:
- the number of columns
- Since:
- 0.1.0
-
height
int height()- Returns:
- the number of rows
- Since:
- 0.1.0
-
items
-
get
- Parameters:
slot- the slot index, row-major- Returns:
- the stack in that slot,
ItemStack.EMPTYwhen it is empty - Since:
- 0.1.0
-
get
- Parameters:
x- the column, from0on the lefty- the row, from0at the top- Returns:
- the stack at that position,
ItemStack.EMPTYwhen it is empty - Since:
- 0.1.0
-
size
int size()- Returns:
width * height- Since:
- 0.1.0
-
nonEmptyCount
int nonEmptyCount()- Returns:
- how many slots hold something
- Since:
- 0.1.0
-
isEmpty
boolean isEmpty()- Returns:
truewhen every slot is empty- Since:
- 0.1.0
-