Record Class IngredientHolder
java.lang.Object
java.lang.Record
net.okocraft.box.feature.craft.model.IngredientHolder
- Record Components:
slot
- the position in the crafting table (0-8)patterns
- theBoxIngredientItem
list that is contained thisIngredientHolder
public record IngredientHolder(int slot, @NotNull @Unmodifiable List<BoxIngredientItem> patterns)
extends Record
A class that holds multiple
BoxIngredientItem
s.-
Constructor Summary
ConstructorDescriptionIngredientHolder
(int slot, @NotNull @Unmodifiable List<BoxIngredientItem> patterns) Creates an instance of aIngredientHolder
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull IngredientHolder
create
(int slot, @NotNull @Unmodifiable List<BoxIngredientItem> patterns) static void
Disables caching objects.static void
Enables caching objects.final boolean
Indicates whether some other object is "equal to" this one.static @NotNull IngredientHolder
fromExactChoice
(int slot, org.bukkit.inventory.RecipeChoice.ExactChoice choice) Creates aIngredientHolder
fromRecipeChoice.ExactChoice
.static @NotNull IngredientHolder
fromMaterialChoice
(int slot, org.bukkit.inventory.RecipeChoice.MaterialChoice choice) Creates aIngredientHolder
fromRecipeChoice.MaterialChoice
.static @NotNull IngredientHolder
fromSingleItem
(int slot, @NotNull org.bukkit.inventory.ItemStack itemStack) Creates aIngredientHolder
from the singleItemStack
.final int
hashCode()
Returns a hash code value for this object.@NotNull @Unmodifiable List
<BoxIngredientItem> patterns()
Returns the value of thepatterns
record component.int
slot()
Returns the position in the crafting table (0-8).final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
enableCache
@Internal public static void enableCache()Enables caching objects. -
disableCache
@Internal public static void disableCache()Disables caching objects. -
create
@NotNull public static @NotNull IngredientHolder create(int slot, @NotNull @NotNull @Unmodifiable List<BoxIngredientItem> patterns) -
fromMaterialChoice
@NotNull public static @NotNull IngredientHolder fromMaterialChoice(int slot, @NotNull org.bukkit.inventory.RecipeChoice.MaterialChoice choice) Creates aIngredientHolder
fromRecipeChoice.MaterialChoice
.- Parameters:
slot
- the position in the crafting table (0-8)choice
- theRecipeChoice.MaterialChoice
instance to createIngredientHolder
- Returns:
- a
IngredientHolder
-
fromExactChoice
@NotNull public static @NotNull IngredientHolder fromExactChoice(int slot, @NotNull org.bukkit.inventory.RecipeChoice.ExactChoice choice) Creates aIngredientHolder
fromRecipeChoice.ExactChoice
.- Parameters:
slot
- the position in the crafting table (0-8)choice
- theRecipeChoice.ExactChoice
instance to createIngredientHolder
- Returns:
- a
IngredientHolder
-
fromSingleItem
@NotNull public static @NotNull IngredientHolder fromSingleItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack itemStack) Creates aIngredientHolder
from the singleItemStack
.- Parameters:
slot
- the position in the crafting table (0-8)itemStack
- theItemStack
to createIngredientHolder
- Returns:
- a
IngredientHolder
-
slot
public int slot()Returns the position in the crafting table (0-8).A 3x3 craft table is represented by the following numbers:
0 1 2
3 4 5
6 7 8
- Returns:
- the position in the crafting table (0-8)
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
patterns
Returns the value of thepatterns
record component.- Returns:
- the value of the
patterns
record component
-