程序包 org.bukkit.inventory

# 类 ShapedRecipe

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

所有已实现的接口:
  `Recipe`, `Keyed`

public class ShapedRecipe extends CraftingRecipe
Represents a shaped (ie normal) crafting recipe.

- ## 构造器概要

  构造器
  构造器
  说明
  `ShapedRecipe(@NotNull ItemStack result)`
  已过时。
  Recipes must have keys.
  `ShapedRecipe(@NotNull NamespacedKey key, @NotNull ItemStack result)`
  Create a shaped recipe to craft the specified ItemStack.

- ## 方法概要

  修饰符和类型
  方法
  说明
  `@NotNull Map<Character,RecipeChoice>`
  `getChoiceMap()`
  Get a copy of the choice map.
  `@NotNull Map<Character,ItemStack>`
  `getIngredientMap()`
  Get a copy of the ingredients map.
  `@NotNull String[]`
  `getShape()`
  Get the shape.
  `@NotNull ShapedRecipe`
  `setIngredient(char key, @NotNull RecipeChoice ingredient)`
  Sets the `RecipeChoice` that a character in the recipe shape refers to.
  `@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)`
  Sets the material that a character in the recipe shape refers to.
  `@NotNull ShapedRecipe`
  `setIngredient(char key, @NotNull Material ingredient, int raw)`
  已过时。
  Magic value
  `@NotNull ShapedRecipe`
  `shape(@NotNull String... shape)`
  Set the shape of this recipe to the specified rows.

  ### 从类继承的方法 org.bukkit.inventory.CraftingRecipe

  `getCategory, getGroup, getKey, getResult, setCategory, setGroup`

  ### 从类继承的方法 java.lang.Object

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

- ## 构造器详细资料

  - ### ShapedRecipe

    @Deprecated public ShapedRecipe(@NotNull @NotNull ItemStack result)
    已过时。
    Recipes must have keys. Use `ShapedRecipe(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.
    参数:
      `result` - The item you want the recipe to create.
    另请参阅:
      - `shape(String...)`
      - `setIngredient(char, Material)`
      - `setIngredient(char, Material, int)`
      - `setIngredient(char, MaterialData)`
      - `setIngredient(char, RecipeChoice)`

  - ### 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.
    参数:
      `key` - the unique recipe key
      `result` - The item you want the recipe to create.
    另请参阅:
      - `shape(String...)`
      - `setIngredient(char, Material)`
      - `setIngredient(char, Material, int)`
      - `setIngredient(char, MaterialData)`
      - `setIngredient(char, RecipeChoice)`

- ## 方法详细资料

  - ### 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; excluding space characters, which must be empty, 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.
    参数:
      `shape` - The rows of the recipe (up to 3 rows).
    返回:
      The changed recipe, so you can chain calls.

  - ### setIngredient

    @NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull MaterialData 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...)`.

    参数:
      `key` - The character that represents the ingredient in the shape.
      `ingredient` - The ingredient.
    返回:
      The changed recipe, so you can chain calls.
    抛出:
      `IllegalArgumentException` - if the `key` is a space character
      `IllegalArgumentException` - if the `key` does 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...)`.

    参数:
      `key` - The character that represents the ingredient in the shape.
      `ingredient` - The ingredient.
    返回:
      The changed recipe, so you can chain calls.
    抛出:
      `IllegalArgumentException` - if the `key` is a space character
      `IllegalArgumentException` - if the `key` does not appear in the shape.

  - ### setIngredient

    @Deprecated @NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull Material ingredient, int raw)
    已过时。
    Magic value
    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...)`.

    参数:
      `key` - The character that represents the ingredient in the shape.
      `ingredient` - The ingredient.
      `raw` - The raw material data as an integer.
    返回:
      The changed recipe, so you can chain calls.
    抛出:
      `IllegalArgumentException` - if the `key` is a space character
      `IllegalArgumentException` - if the `key` does not appear in the shape.

  - ### setIngredient

    @NotNull public @NotNull ShapedRecipe setIngredient(char key, @NotNull @NotNull RecipeChoice ingredient)
    Sets the `RecipeChoice` 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...)`.

    参数:
      `key` - The character that represents the ingredient in the shape.
      `ingredient` - The ingredient.
    返回:
      The changed recipe, so you can chain calls.
    抛出:
      `IllegalArgumentException` - if the `key` is a space character
      `IllegalArgumentException` - if the `key` does not appear in the shape.

  - ### getIngredientMap

    @NotNull public @NotNull Map<Character,ItemStack> getIngredientMap()
    Get a copy of the ingredients map.
    返回:
      The mapping of character to ingredients.

  - ### getChoiceMap

    @NotNull public @NotNull Map<Character,RecipeChoice> getChoiceMap()
    Get a copy of the choice map.
    返回:
      The mapping of character to ingredients.

  - ### getShape

    @NotNull public @NotNull String[] getShape()
    Get the shape.
    返回:
      The recipe's shape.
    抛出:
      `NullPointerException` - when not set yet