Package net.glowstone.inventory.crafting
Class DynamicRecipe
java.lang.Object
net.glowstone.inventory.crafting.DynamicRecipe
- All Implemented Interfaces:
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStack
Gets the result of this recipe, given the input ofmatches(ItemStack[])
.boolean
matches
(org.bukkit.inventory.ItemStack[] matrix) Checks to see if the recipe will match a crafting matrix.void
setMatcher
(ItemMatcher matcher) Sets theItemMatcher
to be used with this recipe.
-
Constructor Details
-
DynamicRecipe
public DynamicRecipe() -
DynamicRecipe
-
-
Method Details
-
setMatcher
Sets theItemMatcher
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 preparesgetResult()
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 ofmatches(ItemStack[])
.- Specified by:
getResult
in interfaceorg.bukkit.inventory.Recipe
- Returns:
- The result of the recipe, or null if it does not match
-