Class ShapedRecipe

java.lang.Object
org.bukkit.inventory.ShapedRecipe
All Implemented Interfaces:
Recipe

public class ShapedRecipe
extends java.lang.Object
implements Recipe
Represents a shaped (ie normal) crafting recipe.
  • Constructor Summary

    Constructors 
    Constructor Description
    ShapedRecipe​(ItemStack result)
    Create a shaped recipe to craft the specified ItemStack.
  • Method Summary

    Modifier and Type Method Description
    java.util.Map<java.lang.Character,​ItemStack> getIngredientMap()
    Get a copy of the ingredients map.
    ItemStack getResult()
    Get the result.
    java.lang.String[] getShape()
    Get the shape.
    ShapedRecipe setIngredient​(char key, Material ingredient)
    Sets the material that a character in the recipe shape refers to.
    ShapedRecipe setIngredient​(char key, MaterialData ingredient)
    Sets the material that a character in the recipe shape refers to.
    ShapedRecipe setIngredient​(char key, Material ingredient, int raw)
    Deprecated.
    Magic value
    ShapedRecipe shape​(java.lang.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
  • Constructor Details

  • Method Details

    • shape

      public ShapedRecipe shape​(java.lang.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

      public ShapedRecipe setIngredient​(char key, MaterialData 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

      public ShapedRecipe setIngredient​(char key, 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 public ShapedRecipe setIngredient​(char key, 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.
    • getIngredientMap

      public java.util.Map<java.lang.Character,​ItemStack> getIngredientMap()
      Get a copy of the ingredients map.
      Returns:
      The mapping of character to ingredients.
    • getShape

      public java.lang.String[] getShape()
      Get the shape.
      Returns:
      The recipe's shape.
    • getResult

      public ItemStack getResult()
      Get the result.
      Specified by:
      getResult in interface Recipe
      Returns:
      The result stack.