Interface ShapedCraftingRecipe.Builder
- All Superinterfaces:
AbstractBuilder<RecipeRegistration>,Builder<RecipeRegistration,,ShapedCraftingRecipe.Builder> ResettableBuilder<RecipeRegistration,,ShapedCraftingRecipe.Builder> ResourceKeyedBuilder<RecipeRegistration,ShapedCraftingRecipe.Builder>
- All Known Subinterfaces:
ShapedCraftingRecipe.Builder.AisleStep,ShapedCraftingRecipe.Builder.AisleStep.ResultStep,ShapedCraftingRecipe.Builder.EndStep,ShapedCraftingRecipe.Builder.ResultStep,ShapedCraftingRecipe.Builder.RowsStep,ShapedCraftingRecipe.Builder.RowsStep.ResultStep
- Enclosing interface:
ShapedCraftingRecipe
ShapedCraftingRecipes.
The shaped recipe pattern can be built one of two ways:
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.
Ingredient log = Ingredient.of(LOG);
ShapedCraftingRecipe.builder()
.aisle("sss")
.where('s', log)
.result(ItemStack.of(WOODEN_PRESSURE_PLATE, 1))
.key(RessourceKey.of(plugin, "my_pressure_plate))
.build();
ShapedCraftingRecipe.builder()
.rows()
.row(log, log, log)
.result(ItemStack.of(WOODEN_PRESSURE_PLATE, 1))
.key(RessourceKey.of(plugin, "my_pressure_plate))
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceIn this Step define one or more Ingredients.static interfaceIn this Step set the group of the Recipe and/or build it.static interfaceIn this Step set the result of the recipe.static interfaceIn this Step add one or more rows of Ingredients. -
Method Summary
Modifier and TypeMethodDescriptionStart building a new recipe based on the aisle pattern.rows()Start building a new recipe with ingredients based on rows.Methods inherited from interface net.kyori.adventure.builder.AbstractBuilder
buildMethods inherited from interface org.spongepowered.api.util.ResourceKeyedBuilder
key
-
Method Details
-
aisle
Start building a new recipe based on the aisle pattern.Use
ShapedCraftingRecipe.Builder.AisleStep.where(char, org.spongepowered.api.item.recipe.crafting.Ingredient)to assign ingredients to characters of the aisles.Use the space character for
Ingredient.empty()Any other not assigned characters will cause an Exception when
ShapedCraftingRecipe.Builder.EndStep.build()ing the Recipe.- Parameters:
aisle- A string array of ingredients- Returns:
- The builder
-
rows
Start building a new recipe with ingredients based on rows. After this callShapedCraftingRecipe.Builder.RowsStep.row(org.spongepowered.api.item.recipe.crafting.Ingredient...)for each row of your recipe.- Returns:
- This builder
-