Package org.bukkit.inventory
Class ShapedRecipe
java.lang.Object
org.bukkit.inventory.CraftingRecipe
org.bukkit.inventory.ShapedRecipe
Represents a shaped (ie normal) crafting recipe.
- 
Constructor SummaryConstructorsConstructorDescriptionShapedRecipe(@NotNull ItemStack result) Deprecated.Recipes must have keys.ShapedRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result) Create a shaped recipe to craft the specified ItemStack.
- 
Method SummaryModifier and TypeMethodDescriptionGet a copy of the choice map.Deprecated.UsegetChoiceMap()instead for more complete data.getShape()Get the shape.setIngredient(char key, @NotNull ItemStack item) setIngredient(char key, @NotNull RecipeChoice ingredient) Sets theRecipeChoicethat a character in the recipe shape refers to.setIngredient(char key, @NotNull Material ingredient) Sets the material that a character in the recipe shape refers to.setIngredient(char key, @NotNull MaterialData ingredient) Deprecated.setIngredient(char key, @NotNull Material ingredient, int raw) Deprecated.Magic valueSet the shape of this recipe to the specified rows.Methods inherited from class org.bukkit.inventory.CraftingRecipegetCategory, getGroup, getKey, getResult, setCategory, setGroup
- 
Constructor Details- 
ShapedRecipeDeprecated.Recipes must have keys. UseShapedRecipe(NamespacedKey, ItemStack)instead.Create a shaped recipe to craft the specified ItemStack. The constructor merely determines the result and type; to set the actual recipe, you'll need to call the appropriate methods.- Parameters:
- result- The item you want the recipe to create.
- See Also:
 
- 
ShapedRecipeCreate a shaped recipe to craft the specified ItemStack. The constructor merely determines the result and type; to set the actual recipe, you'll need to call the appropriate methods.- Parameters:
- key- the unique recipe key
- result- The item you want the recipe to create.
- See Also:
 
 
- 
- 
Method Details- 
shapeSet the shape of this recipe to the specified rows. Each character represents a different ingredient; exactly what each character represents is set separately. The first row supplied corresponds with the upper most part of the recipe on the workbench e.g. if all three rows are supplies the first string represents the top row on the workbench.- Parameters:
- shape- The rows of the recipe (up to 3 rows).
- Returns:
- The changed recipe, so you can chain calls.
 
- 
setIngredient@NotNull @Deprecated public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull MaterialData ingredient) Deprecated.Sets the material that a character in the recipe shape refers to.Note that before an ingredient can be set, the recipe's shape must be defined with shape(String...).- Parameters:
- key- The character that represents the ingredient in the shape.
- ingredient- The ingredient.
- Returns:
- The changed recipe, so you can chain calls.
- Throws:
- IllegalArgumentException- if the- keydoes not appear in the shape.
 
- 
setIngredient@NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull Material ingredient) Sets the material that a character in the recipe shape refers to.Note that before an ingredient can be set, the recipe's shape must be defined with shape(String...).- Parameters:
- key- The character that represents the ingredient in the shape.
- ingredient- The ingredient.
- Returns:
- The changed recipe, so you can chain calls.
- Throws:
- IllegalArgumentException- if the- keydoes not appear in the shape.
 
- 
setIngredient@Deprecated @NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull Material ingredient, int raw) Deprecated.Magic valueSets the material that a character in the recipe shape refers to.Note that before an ingredient can be set, the recipe's shape must be defined with shape(String...).- Parameters:
- key- The character that represents the ingredient in the shape.
- ingredient- The ingredient.
- raw- The raw material data as an integer.
- Returns:
- The changed recipe, so you can chain calls.
- Throws:
- IllegalArgumentException- if the- keydoes not appear in the shape.
 
- 
setIngredient@NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull RecipeChoice ingredient) Sets theRecipeChoicethat a character in the recipe shape refers to.Note that before an ingredient can be set, the recipe's shape must be defined with shape(String...).- Parameters:
- key- The character that represents the ingredient in the shape.
- ingredient- The ingredient.
- Returns:
- The changed recipe, so you can chain calls.
- Throws:
- IllegalArgumentException- if the- keydoes not appear in the shape.
 
- 
setIngredient
- 
getIngredientMapDeprecated.UsegetChoiceMap()instead for more complete data.Get a copy of the ingredients map.- Returns:
- The mapping of character to ingredients.
 
- 
getChoiceMapGet a copy of the choice map.- Returns:
- The mapping of character to ingredients.
 
- 
getShapeGet the shape.- Returns:
- The recipe's shape.
- Throws:
- NullPointerException- when not set yet
 
 
-