Class CraftingRecipe

java.lang.Object
org.bukkit.inventory.CraftingRecipe
All Implemented Interfaces:
Recipe, Keyed
Direct Known Subclasses:
ShapedRecipe, ShapelessRecipe

public abstract class CraftingRecipe extends Object implements Recipe, Keyed
Represents a shaped or shapeless crafting recipe.
  • Constructor Details

  • Method Details

    • getKey

      @NotNull 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
    • getResult

      @NotNull public ItemStack getResult()
      Get the result of this recipe.
      Specified by:
      getResult in interface Recipe
      Returns:
      The result stack.
    • getGroup

      @NotNull 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(@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.
    • getCategory

      @NotNull public CraftingBookCategory getCategory()
      Gets the category which this recipe will appear in the recipe book under.
      Defaults to CraftingBookCategory.MISC if not set.
      Returns:
      recipe book category
    • setCategory

      public void setCategory(@NotNull CraftingBookCategory category)
      Sets the category which this recipe will appear in the recipe book under.
      Defaults to CraftingBookCategory.MISC if not set.
      Parameters:
      category - recipe book category
    • checkResult

      @Internal @NotNull protected static ItemStack checkResult(@NotNull ItemStack result)
      Checks an ItemStack to be used in constructors related to CraftingRecipe is not empty.
      Parameters:
      result - an ItemStack
      Returns:
      the same result ItemStack
      Throws:
      IllegalArgumentException - if the result is an empty item (AIR)