Package org.bukkit.inventory
Class ShapelessRecipe
java.lang.Object
org.bukkit.inventory.ShapelessRecipe
Represents a shapeless recipe, where the arrangement of the ingredients on
the crafting grid does not matter.
-
Constructor Summary
ConstructorDescriptionShapelessRecipe
(ItemStack result) Deprecated.ShapelessRecipe
(NamespacedKey key, ItemStack result) Create a shapeless recipe to craft the specified ItemStack. -
Method Summary
Modifier and TypeMethodDescriptionaddIngredient
(int count, Material ingredient) Adds multiples of the specified ingredient.addIngredient
(int count, MaterialData ingredient) Adds multiples of the specified ingredient.addIngredient
(int count, Material ingredient, int rawdata) Deprecated.Magic valueaddIngredient
(RecipeChoice ingredient) addIngredient
(Material ingredient) Adds the specified ingredient.addIngredient
(MaterialData ingredient) Adds the specified ingredient.addIngredient
(Material ingredient, int rawdata) Deprecated.Magic valueGets the category which this recipe will appear in the recipe book under.getGroup()
Get the group of this recipe.Get the list of ingredients used for this recipe.getKey()
Return the namespaced identifier for this object.Get the result of this recipe.removeIngredient
(int count, Material ingredient) Removes multiple instances of an ingredient from the list.removeIngredient
(int count, MaterialData ingredient) Removes multiple instances of an ingredient from the list.removeIngredient
(int count, Material ingredient, int rawdata) Deprecated.Magic valueremoveIngredient
(RecipeChoice ingredient) Removes an ingredient from the list.removeIngredient
(Material ingredient) Removes an ingredient from the list.removeIngredient
(MaterialData ingredient) Removes an ingredient from the list.removeIngredient
(Material ingredient, int rawdata) Deprecated.Magic valuevoid
setCategory
(CraftingBookCategory category) Sets the category which this recipe will appear in the recipe book under.void
Set the group of this recipe.
-
Constructor Details
-
ShapelessRecipe
Deprecated. -
ShapelessRecipe
Create a shapeless 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.- Parameters:
key
- the unique recipe keyresult
- The item you want the recipe to create.- See Also:
-
-
Method Details
-
addIngredient
Adds the specified ingredient.- Parameters:
ingredient
- The ingredient to add.- Returns:
- The changed recipe, so you can chain calls.
-
addIngredient
Adds the specified ingredient.- Parameters:
ingredient
- The ingredient to add.- Returns:
- The changed recipe, so you can chain calls.
-
addIngredient
@Deprecated @NotNull public ShapelessRecipe addIngredient(@NotNull Material ingredient, int rawdata) Deprecated.Magic valueAdds the specified ingredient.- Parameters:
ingredient
- The ingredient to add.rawdata
- The data value, or -1 to allow any data value.- Returns:
- The changed recipe, so you can chain calls.
-
addIngredient
Adds multiples of the specified ingredient.- Parameters:
count
- How many to add (can't be more than 9!)ingredient
- The ingredient to add.- Returns:
- The changed recipe, so you can chain calls.
-
addIngredient
Adds multiples of the specified ingredient.- Parameters:
count
- How many to add (can't be more than 9!)ingredient
- The ingredient to add.- Returns:
- The changed recipe, so you can chain calls.
-
addIngredient
@Deprecated @NotNull public ShapelessRecipe addIngredient(int count, @NotNull Material ingredient, int rawdata) Deprecated.Magic valueAdds multiples of the specified ingredient.- Parameters:
count
- How many to add (can't be more than 9!)ingredient
- The ingredient to add.rawdata
- The data value, or -1 to allow any data value.- Returns:
- The changed recipe, so you can chain calls.
-
addIngredient
-
removeIngredient
Removes an ingredient from the list.- Parameters:
ingredient
- The ingredient to remove- Returns:
- The changed recipe.
-
removeIngredient
Removes an ingredient from the list. If the ingredient occurs multiple times, only one instance of it is removed. Only removes exact matches, with a data value of 0.- Parameters:
ingredient
- The ingredient to remove- Returns:
- The changed recipe.
-
removeIngredient
Removes an ingredient from the list. If the ingredient occurs multiple times, only one instance of it is removed. If the data value is -1, only ingredients with a -1 data value will be removed.- Parameters:
ingredient
- The ingredient to remove- Returns:
- The changed recipe.
-
removeIngredient
Removes multiple instances of an ingredient from the list. If there are less instances then specified, all will be removed. Only removes exact matches, with a data value of 0.- Parameters:
count
- The number of copies to remove.ingredient
- The ingredient to remove- Returns:
- The changed recipe.
-
removeIngredient
Removes multiple instances of an ingredient from the list. If there are less instances then specified, all will be removed. If the data value is -1, only ingredients with a -1 data value will be removed.- Parameters:
count
- The number of copies to remove.ingredient
- The ingredient to remove.- Returns:
- The changed recipe.
-
removeIngredient
@Deprecated @NotNull public ShapelessRecipe removeIngredient(@NotNull Material ingredient, int rawdata) Deprecated.Magic valueRemoves an ingredient from the list. If the ingredient occurs multiple times, only one instance of it is removed. If the data value is -1, only ingredients with a -1 data value will be removed.- Parameters:
ingredient
- The ingredient to removerawdata
- The data value;- Returns:
- The changed recipe.
-
removeIngredient
@Deprecated @NotNull public ShapelessRecipe removeIngredient(int count, @NotNull Material ingredient, int rawdata) Deprecated.Magic valueRemoves multiple instances of an ingredient from the list. If there are less instances then specified, all will be removed. If the data value is -1, only ingredients with a -1 data value will be removed.- Parameters:
count
- The number of copies to remove.ingredient
- The ingredient to remove.rawdata
- The data value.- Returns:
- The changed recipe.
-
getResult
Get the result of this recipe. -
getIngredientList
Get the list of ingredients used for this recipe.- Returns:
- The input list
-
getChoiceList
-
getKey
Description copied from interface:Keyed
Return the namespaced identifier for this object. -
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
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
Gets the category which this recipe will appear in the recipe book under. Defaults toCraftingBookCategory.MISC
if not set.- Returns:
- recipe book category
-
setCategory
Sets the category which this recipe will appear in the recipe book under. Defaults toCraftingBookCategory.MISC
if not set.- Parameters:
category
- recipe book category
-