Interface ShapedRecipe
- All Superinterfaces:
CraftingRecipe, Recipe
A recipe whose ingredients must sit in a given layout, anywhere in the grid.
Like vanilla, the empty rows and columns around the pattern are trimmed, the pattern may sit anywhere in a grid large enough to hold it, and it also matches flipped left to right unless told otherwise. Every slot outside the pattern must be empty.
Each ingredient takes its own count from its slot, so a pattern may ask for sixteen diamond blocks in one slot and a single stick in another.
- Since:
- 0.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds aShapedRecipe, vanilla-style: a pattern of characters and what each one stands for. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe largest pattern, the size of a crafting table. -
Method Summary
Modifier and TypeMethodDescriptionstatic ShapedRecipe.Builderintheight()ingredient(int x, int y) booleanmirrored()result()intwidth()Methods inherited from interface CraftingRecipe
category, group, match
-
Field Details
-
MAX_SIZE
static final int MAX_SIZEThe largest pattern, the size of a crafting table.- Since:
- 0.1.0
- See Also:
-
-
Method Details
-
builder
- Parameters:
key- the identifier of the recipe- Returns:
- a builder for a shaped recipe
- Since:
- 0.1.0
-
width
int width()- Returns:
- the number of columns of the trimmed pattern
- Since:
- 0.1.0
-
height
int height()- Returns:
- the number of rows of the trimmed pattern
- Since:
- 0.1.0
-
ingredient
- Parameters:
x- the column of the trimmed patterny- the row of the trimmed pattern- Returns:
- what that cell asks for,
nullwhen it must stay empty - Throws:
IndexOutOfBoundsException- if the cell is outside the pattern- Since:
- 0.1.0
-
result
ItemStack result()- Returns:
- what one craft gives
- Since:
- 0.1.0
-
mirrored
boolean mirrored()- Returns:
- whether the pattern also matches flipped left to right
- Since:
- 0.1.0
-