Record Class RecipeIngredient
java.lang.Object
java.lang.Record
dev.itsharshxd.zentrix.api.recipe.RecipeIngredient
- Record Components:
key- the pattern character of a shaped crafting ingredient;nullotherwisematching- how the recipe compares an offered item withoptions()options- the items the ingredient accepts; forRecipeIngredient.Matching.MATERIAL, one item per accepted material
public record RecipeIngredient(@Nullable Character key, @NotNull RecipeIngredient.Matching matching, @NotNull List<org.bukkit.inventory.ItemStack> options)
extends Record
One ingredient of a recipe, with every item it accepts.
ZentrixRecipe.getIngredients() shows one representative item per ingredient; this
keeps them all. The items are copies.
- Since:
- 1.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow an offered item is compared with an ingredient's items. -
Constructor Summary
ConstructorsConstructorDescriptionRecipeIngredient(@Nullable Character key, @NotNull RecipeIngredient.Matching matching, @NotNull List<org.bukkit.inventory.ItemStack> options) Creates an instance of aRecipeIngredientrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable Characterkey()Returns the value of thekeyrecord component.The pattern character, for a shaped crafting ingredient.@NotNull RecipeIngredient.Matchingmatching()Returns the value of thematchingrecord component.@NotNull List<org.bukkit.inventory.ItemStack> options()Fresh copies of the accepted items, safe to change.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RecipeIngredient
public RecipeIngredient(@Nullable @Nullable Character key, @NotNull @NotNull RecipeIngredient.Matching matching, @NotNull @NotNull List<org.bukkit.inventory.ItemStack> options) Creates an instance of aRecipeIngredientrecord class.
-
-
Method Details
-
keyIfShaped
The pattern character, for a shaped crafting ingredient. -
options
Fresh copies of the accepted items, safe to change. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
matching
Returns the value of thematchingrecord component.- Returns:
- the value of the
matchingrecord component
-