Class DynamicRecipe

java.lang.Object
net.glowstone.inventory.crafting.DynamicRecipe
All Implemented Interfaces:
org.bukkit.inventory.Recipe

public class DynamicRecipe extends Object implements org.bukkit.inventory.Recipe

Represents a dynamic recipe. These are recipes that have can have different results, depending on the inputs used, rather than a simple matching algorithm.

Used for recipes such as banners, which require item metadata to be copied to an item, along with having a semi-shaped recipe.

  • Constructor Details

    • DynamicRecipe

      public DynamicRecipe()
    • DynamicRecipe

      public DynamicRecipe(ItemMatcher matcher)
  • Method Details

    • setMatcher

      public void setMatcher(ItemMatcher matcher)
      Sets the ItemMatcher to be used with this recipe.
      Parameters:
      matcher - ItemMatcher to use. Must not be null.
    • matches

      public boolean matches(org.bukkit.inventory.ItemStack[] matrix)
      Checks to see if the recipe will match a crafting matrix. This method also prepares getResult() to return the correct item (including all metadata) for the input.
      Parameters:
      matrix - Items on the crafting grid
      Returns:
      Whether the recipe matches the inputs
    • getResult

      public org.bukkit.inventory.ItemStack getResult()
      Gets the result of this recipe, given the input of matches(ItemStack[]).
      Specified by:
      getResult in interface org.bukkit.inventory.Recipe
      Returns:
      The result of the recipe, or null if it does not match