Class ShapedRecipe

  • All Implemented Interfaces:
    Recipe, Keyed

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

      • shape

        public ShapedRecipe shape​(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 Map<Character,​ItemStack> getIngredientMap()
        Get a copy of the ingredients map.
        Returns:
        The mapping of character to ingredients.
      • getShape

        public 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.
      • getKey

        public 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

        public 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​(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.