Package wtf.choco.alchema.crafting
Class CauldronRecipe
java.lang.Object
wtf.choco.alchema.crafting.CauldronRecipe
public class CauldronRecipe
extends java.lang.Object
Represents a recipe that may be crafted in an
AlchemicalCauldron
.- Author:
- Parker Hawke - Choco
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CauldronRecipe.Builder
A builder for immutableCauldronRecipe
instances. -
Constructor Summary
Constructors Constructor Description CauldronRecipe(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.ItemStack result, int experience, @NotNull java.util.List<@NotNull CauldronIngredient> ingredients)
Deprecated.this class will not be constructible in 1.2.0.CauldronRecipe(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.ItemStack result, int experience, @NotNull CauldronIngredient ingredient)
Deprecated.this class will not be constructible in 1.2.0.CauldronRecipe(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.ItemStack result, int experience, @NotNull CauldronIngredient... ingredients)
Deprecated.this class will not be constructible in 1.2.0.CauldronRecipe(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.ItemStack result, @NotNull java.util.List<@NotNull CauldronIngredient> ingredients)
Deprecated.this class will not be constructible in 1.2.0.CauldronRecipe(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.ItemStack result, @NotNull CauldronIngredient ingredient)
Deprecated.this class will not be constructible in 1.2.0.CauldronRecipe(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.ItemStack result, @NotNull CauldronIngredient... ingredients)
Deprecated.this class will not be constructible in 1.2.0. -
Method Summary
Modifier and Type Method Description static CauldronRecipe.Builder
builder(@NotNull org.bukkit.NamespacedKey key, @NotNull org.bukkit.inventory.ItemStack result)
Create a new CauldronRecipe builder instance.boolean
equals(java.lang.Object obj)
static @NotNull CauldronRecipe
fromJson(@NotNull org.bukkit.NamespacedKey key, @NotNull com.google.gson.JsonObject object, @NotNull CauldronRecipeRegistry recipeRegistry)
Read the contents of the providedJsonObject
into a newCauldronRecipe
instance.@NotNull java.util.Optional<@NotNull java.lang.String>
getComment()
Get the comment for this recipe if one is set.int
getComplexity()
Get the numerical complexity of this recipe.int
getExperience()
Get the experience yielded from this recipe.@NotNull java.util.List<@NotNull CauldronIngredient>
getIngredients()
Get an unmodifiable set of all required ingredients.@NotNull org.bukkit.NamespacedKey
getKey()
Get the key of this recipe.@NotNull org.bukkit.inventory.ItemStack
getResult()
Get the result of this recipe.int
getYieldFromIngredients(@NotNull java.util.List<@NotNull CauldronIngredient> availableIngredients)
Get the expected yield (i.e.int
hashCode()
boolean
hasIngredient(@NotNull CauldronIngredient ingredient)
Check whether this recipe contains the specified ingredient.void
setComment(@Nullable java.lang.String comment)
Deprecated.this class will not be constructable in 1.2.0.void
setComment(@Nullable java.util.Optional<@NotNull java.lang.String> comment)
Deprecated.inconvenient parameter.java.lang.String
toString()
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
CauldronRecipe
@Deprecated public CauldronRecipe(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.ItemStack result, int experience, @NotNull @NotNull java.util.List<@NotNull CauldronIngredient> ingredients)Deprecated.this class will not be constructible in 1.2.0. Seebuilder(NamespacedKey, ItemStack)
Construct a new CauldronRecipe with a unique ID,ItemStack
result, and a set of required ingredients- Parameters:
key
- the unique recipe keyresult
- the result of the recipeexperience
- the experience to reward the playeringredients
- the set of ingredients
-
CauldronRecipe
@Deprecated public CauldronRecipe(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.ItemStack result, int experience, @NotNull @NotNull CauldronIngredient... ingredients)Deprecated.this class will not be constructible in 1.2.0. Seebuilder(NamespacedKey, ItemStack)
Construct a new CauldronRecipe with a unique ID,ItemStack
result, and a set of required ingredients- Parameters:
key
- the unique recipe keyresult
- the result of the recipeexperience
- the experience to reward the playeringredients
- the set of ingredients
-
CauldronRecipe
@Deprecated public CauldronRecipe(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.ItemStack result, int experience, @NotNull @NotNull CauldronIngredient ingredient)Deprecated.this class will not be constructible in 1.2.0. Seebuilder(NamespacedKey, ItemStack)
Construct a new CauldronRecipe with a unique ID,ItemStack
result and a single ingredient.- Parameters:
key
- the unique recipe keyresult
- the result of the recipeexperience
- the experience to reward the playeringredient
- the recipe ingredient
-
CauldronRecipe
@Deprecated public CauldronRecipe(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.ItemStack result, @NotNull @NotNull java.util.List<@NotNull CauldronIngredient> ingredients)Deprecated.this class will not be constructible in 1.2.0. Seebuilder(NamespacedKey, ItemStack)
Construct a new CauldronRecipe with a unique ID,ItemStack
result, and a set of required ingredients- Parameters:
key
- the unique recipe keyresult
- the result of the recipeingredients
- the set of ingredients
-
CauldronRecipe
@Deprecated public CauldronRecipe(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.ItemStack result, @NotNull @NotNull CauldronIngredient... ingredients)Deprecated.this class will not be constructible in 1.2.0. Seebuilder(NamespacedKey, ItemStack)
Construct a new CauldronRecipe with a unique ID,ItemStack
result, and a set of required ingredients- Parameters:
key
- the unique recipe keyresult
- the result of the recipeingredients
- the set of ingredients
-
CauldronRecipe
@Deprecated public CauldronRecipe(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.ItemStack result, @NotNull @NotNull CauldronIngredient ingredient)Deprecated.this class will not be constructible in 1.2.0. Seebuilder(NamespacedKey, ItemStack)
Construct a new CauldronRecipe with a unique ID,ItemStack
result and a single ingredient.- Parameters:
key
- the unique recipe keyresult
- the result of the recipeingredient
- the recipe ingredient
-
-
Method Details
-
getKey
@NotNull public @NotNull org.bukkit.NamespacedKey getKey()Get the key of this recipe.- Returns:
- the key
-
getResult
@NotNull public @NotNull org.bukkit.inventory.ItemStack getResult()Get the result of this recipe.- Returns:
- the result
-
getExperience
public int getExperience()Get the experience yielded from this recipe.- Returns:
- the experience
-
setComment
@Deprecated public void setComment(@Nullable @Nullable java.util.Optional<@NotNull java.lang.String> comment)Deprecated.inconvenient parameter. SeesetComment(String)
insteadSet the comment for this recipe.- Parameters:
comment
- the comment to set or null
-
setComment
@Deprecated public void setComment(@Nullable @Nullable java.lang.String comment)Deprecated.this class will not be constructable in 1.2.0. Seebuilder(NamespacedKey, ItemStack)
Set the comment for this recipe.- Parameters:
comment
- the comment to set or null
-
getComment
@NotNull public @NotNull java.util.Optional<@NotNull java.lang.String> getComment()Get the comment for this recipe if one is set.- Returns:
- the comment
-
hasIngredient
Check whether this recipe contains the specified ingredient. Quantity is not accounted for in this check.- Parameters:
ingredient
- the ingredient to check- Returns:
- true if the ingredient is present
-
getIngredients
Get an unmodifiable set of all required ingredients.- Returns:
- the required ingredients
-
getComplexity
public int getComplexity()Get the numerical complexity of this recipe.Complexity is determine by the amount of each ingredient in this recipe.
- Returns:
- the complexity. Higher numbers are more complex. Will always be >= 0
-
getYieldFromIngredients
public int getYieldFromIngredients(@NotNull @NotNull java.util.List<@NotNull CauldronIngredient> availableIngredients)Get the expected yield (i.e. quantity of result) that may be produced such that the provided ingredients will not be over-consumed.- Parameters:
availableIngredients
- the ingredients available in the cauldron.- Returns:
- the recipe yield
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
builder
@NotNull public static CauldronRecipe.Builder builder(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull org.bukkit.inventory.ItemStack result)Create a new CauldronRecipe builder instance.- Parameters:
key
- the recipe keyresult
- the result of the cauldron recipe- Returns:
- the builder instance
-
fromJson
@NotNull public static @NotNull CauldronRecipe fromJson(@NotNull @NotNull org.bukkit.NamespacedKey key, @NotNull @NotNull com.google.gson.JsonObject object, @NotNull @NotNull CauldronRecipeRegistry recipeRegistry)Read the contents of the providedJsonObject
into a newCauldronRecipe
instance.- Parameters:
key
- the key of the recipe to createobject
- the object from which to readrecipeRegistry
- the recipe registry- Returns:
- the cauldron recipe
-