Package org.bukkit.inventory

# Class ShapedRecipe

java.lang.Object
org.bukkit.inventory.ShapedRecipe

All Implemented Interfaces:
  `net.kyori.adventure.key.Keyed`, `Recipe`, `Keyed`

public class ShapedRecipe extends Object implements Recipe, Keyed
Represents a shaped (ie normal) crafting recipe.

## Constructor Summary

Constructors
Constructor
Description
`ShapedRecipe(@NotNull ItemStack result)`
Deprecated.
`ShapedRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result)`
Create a shaped recipe to craft the specified ItemStack.

## Method Summary

Modifier and Type
Method
Description
`@NotNull Map<Character,RecipeChoice>`
`getChoiceMap()`
`@NotNull String`
`getGroup()`
Get the group of this recipe.
`@NotNull Map<Character,ItemStack>`
`getIngredientMap()`
Get a copy of the ingredients map.
`@NotNull NamespacedKey`
`getKey()`
Return the namespaced identifier for this object.
`@NotNull ItemStack`
`getResult()`
Get the result.
`@NotNull String[]`
`getShape()`
Get the shape.
`void`
`setGroup(@NotNull String group)`
Set the group of this recipe.
`@NotNull ShapedRecipe`
`setIngredient(char key, @NotNull ItemStack item)`
`@NotNull ShapedRecipe`
`setIngredient(char key, @NotNull RecipeChoice ingredient)`
`@NotNull ShapedRecipe`
`setIngredient(char key, @NotNull Material ingredient)`
Sets the material that a character in the recipe shape refers to.
`@NotNull ShapedRecipe`
`setIngredient(char key, @NotNull MaterialData ingredient)`
Deprecated.
use `setIngredient(char, RecipeChoice)`
`@NotNull ShapedRecipe`
`setIngredient(char key, @NotNull Material ingredient, int raw)`
Deprecated.
Magic value
`@NotNull ShapedRecipe`
`shape(@NotNull String... shape)`
Set the shape of this recipe to the specified rows.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.bukkit.Keyed

`key`

## Constructor Details

### ShapedRecipe

@Deprecated public ShapedRecipe(@NotNull @NotNull ItemStack result)
Deprecated.

### ShapedRecipe

public ShapedRecipe(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull ItemStack result)
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:
  `key` - the unique recipe key
  `result` - The item you want the recipe to create.
See Also:
  - `shape(String...)`
  - `setIngredient(char, Material)`
  - `setIngredient(char, Material, int)`
  - `setIngredient(char, MaterialData)`

## Method Details

### shape

@NotNull public @NotNull ShapedRecipe shape(@NotNull @NotNull String... shape)
Set 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.
use `setIngredient(char, RecipeChoice)`
Sets the material that a character in the recipe shape refers to.

Parameters:
  `key` - The character that represents the ingredient in the shape.
  `ingredient` - The ingredient.
Returns:
  The changed recipe, so you can chain calls.

### setIngredient

@NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull Material ingredient)
Sets the material that a character in the recipe shape refers to.

Parameters:
  `key` - The character that represents the ingredient in the shape.
  `ingredient` - The ingredient.
Returns:
  The changed recipe, so you can chain calls.

### setIngredient

@Deprecated @NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull Material ingredient, int raw)
Deprecated.
Magic value
Sets the material that a character in the recipe shape refers to.

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.

### setIngredient

@NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull RecipeChoice ingredient)

### setIngredient

@NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull ItemStack item)

### getIngredientMap

@NotNull public @NotNull Map<Character,ItemStack> getIngredientMap()
Get a copy of the ingredients map.

Returns:
  The mapping of character to ingredients.

### getChoiceMap

@NotNull public @NotNull Map<Character,RecipeChoice> getChoiceMap()

### getShape

@NotNull public @NotNull String[] getShape()
Get the shape.

Returns:
  The recipe's shape.
Throws:
  `NullPointerException` - when not set yet

### getResult

@NotNull public @NotNull ItemStack getResult()
Get the result.

Specified by:
  `getResult` in interface `Recipe`
Returns:
  The result stack.

### getKey

@NotNull public @NotNull NamespacedKey getKey()
Description copied from interface: `Keyed`
Return the namespaced identifier for this object.

Specified by:
  `getKey` in interface `Keyed`
Returns:
  this object's key

### getGroup

@NotNull public @NotNull String getGroup()
Get the group of this recipe. Recipes with the same group may be grouped together when displayed in the client.

Returns:
  recipe group. An empty string denotes no group. May not be null.

### setGroup

public void setGroup(@NotNull @NotNull String group)
Set the group of this recipe. Recipes with the same group may be grouped together when displayed in the client.

Parameters:
  `group` - recipe group. An empty string denotes no group. May not be null.