public static interface ShapedCraftingRecipe.Builder extends ResettableBuilder<ShapedCraftingRecipe,ShapedCraftingRecipe.Builder>
ShapedCraftingRecipe
s through.
First decide how you want to build your recipe. Either by defining
the pattern with aisle(java.lang.String...)
and then setting ShapedCraftingRecipe.Builder.AisleStep.where(char, org.spongepowered.api.item.recipe.crafting.Ingredient)
the ingredients are, or by defining the pattern using rows()
adding each ShapedCraftingRecipe.Builder.RowsStep.row(org.spongepowered.api.item.recipe.crafting.Ingredient...)
of ingredients after the other. When the
ingredients are set define the ShapedCraftingRecipe.Builder.ResultStep.result(org.spongepowered.api.item.inventory.ItemStackSnapshot)
of the recipe.
Next you can define its ShapedCraftingRecipe.Builder.EndStep.group(java.lang.String)
. And
finally ShapedCraftingRecipe.Builder.EndStep.build(java.lang.String, java.lang.Object)
your recipe.
Here is an example, where the two resulting recipes are identical:
Ingredient log = Ingredient.of(LOG);
ShapedCraftingRecipe.builder()
.aisle("sss")
.where('s', log)
.result(ItemStack.of(WOODEN_PRESSURE_PLATE, 1))
.build("mypressureplate", plugin);
ShapedCraftingRecipe.builder()
.rows()
.row(log, log, log)
.result(ItemStack.of(WOODEN_PRESSURE_PLATE, 1))
.build("mypressureplate", plugin);
Modifier and Type | Interface and Description |
---|---|
static interface |
ShapedCraftingRecipe.Builder.AisleStep
In this Step define one or more Ingredients.
|
static interface |
ShapedCraftingRecipe.Builder.EndStep
In this Step set the group of the Recipe and/or build it.
|
static interface |
ShapedCraftingRecipe.Builder.ResultStep
In this Step set the result of the recipe.
|
static interface |
ShapedCraftingRecipe.Builder.RowsStep
In this Step add one or more rows of Ingredients.
|
Modifier and Type | Method and Description |
---|---|
ShapedCraftingRecipe.Builder.AisleStep |
aisle(String... aisle)
Start building a new recipe based on the aisle pattern.
|
ShapedCraftingRecipe.Builder.RowsStep |
rows()
Start building a new recipe with ingredients based on rows.
|
from, reset
ShapedCraftingRecipe.Builder.AisleStep aisle(String... aisle)
Use ShapedCraftingRecipe.Builder.AisleStep.where(char, org.spongepowered.api.item.recipe.crafting.Ingredient)
to assign ingredients to characters
of the aisles.
The space character will be defaulted to Ingredient.NONE
if not specified.
Any other not assigned characters will cause an Exception
when ShapedCraftingRecipe.Builder.EndStep.build(java.lang.String, java.lang.Object)
ing the Recipe.
aisle
- A string array of ingredientsShapedCraftingRecipe.Builder.RowsStep rows()
ShapedCraftingRecipe.Builder.RowsStep.row(org.spongepowered.api.item.recipe.crafting.Ingredient...)
for each row of your recipe.