Class SmithingRecipe

java.lang.Object
org.bukkit.inventory.SmithingRecipe
All Implemented Interfaces:
Keyed, Recipe, Keyed
Direct Known Subclasses:
SmithingTransformRecipe, SmithingTrimRecipe

public class SmithingRecipe extends Object implements Recipe, Keyed
Represents a smithing recipe.
  • Constructor Details

    • SmithingRecipe

      @Deprecated(since="1.20.1") public SmithingRecipe(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull ItemStack result, @Nullable @Nullable RecipeChoice base, @Nullable @Nullable RecipeChoice addition)
      Deprecated.
      as of Minecraft 1.20, smithing recipes are now separated into two distinct recipe types, SmithingTransformRecipe and SmithingTrimRecipe. This class now acts as a base class to these two classes and will do nothing when added to the server.
      Create a smithing recipe to produce the specified result ItemStack.
      Parameters:
      key - The unique recipe key
      result - The item you want the recipe to create.
      base - The base ingredient
      addition - The addition ingredient
    • SmithingRecipe

      @Deprecated public SmithingRecipe(@NotNull @NotNull NamespacedKey key, @NotNull @NotNull ItemStack result, @Nullable @Nullable RecipeChoice base, @Nullable @Nullable RecipeChoice addition, boolean copyDataComponents)
      Create a smithing recipe to produce the specified result ItemStack.
      Parameters:
      key - The unique recipe key
      result - The item you want the recipe to create.
      base - The base ingredient
      addition - The addition ingredient
      copyDataComponents - whether to copy the data components from the input base item to the output
  • Method Details

    • getBase

      @NotNull public @NotNull RecipeChoice getBase()
      Get the base recipe item.
      Returns:
      base choice
    • getAddition

      @NotNull public @NotNull RecipeChoice getAddition()
      Get the addition recipe item.
      Returns:
      addition choice
    • getResult

      @NotNull public @NotNull ItemStack getResult()
      Description copied from interface: Recipe
      Get the result of this recipe.
      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
    • willCopyNbt

      @Obsolete(since="1.20.5") public boolean willCopyNbt()
      Whether to copy the NBT of the input base item to the output.
      Returns:
      true to copy the NBT (default for vanilla smithing recipes)
      API Note:
      use willCopyDataComponents()
    • willCopyDataComponents

      public boolean willCopyDataComponents()
      Whether to copy the data components of the input base item to the output.
      Returns:
      true to copy the data components (default for vanilla smithing recipes)