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- theBoxIngredientItemlist that is contained thisIngredientHolder
public record IngredientHolder(int slot, @NotNull @Unmodifiable List<BoxIngredientItem> patterns)
extends Record
A class that holds multiple
BoxIngredientItems.-
Constructor Summary
ConstructorsConstructorDescriptionIngredientHolder(int slot, @NotNull @Unmodifiable List<BoxIngredientItem> patterns) Creates an instance of aIngredientHolderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull IngredientHoldercreate(int slot, @NotNull @Unmodifiable List<BoxIngredientItem> patterns) static voidDisables caching objects.static voidEnables caching objects.final booleanIndicates whether some other object is "equal to" this one.static @NotNull IngredientHolderfromExactChoice(int slot, RecipeChoice.ExactChoice choice) Creates aIngredientHolderfromRecipeChoice.ExactChoice.static @NotNull IngredientHolderfromMaterialChoice(int slot, RecipeChoice.MaterialChoice choice) Creates aIngredientHolderfromRecipeChoice.MaterialChoice.static @NotNull IngredientHolderfromSingleItem(int slot, @NotNull ItemStack itemStack) Creates aIngredientHolderfrom the singleItemStack.final inthashCode()Returns a hash code value for this object.@NotNull @Unmodifiable List<BoxIngredientItem> patterns()Returns the value of thepatternsrecord component.intslot()Returns the position in the crafting table (0-8).final StringtoString()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 RecipeChoice.MaterialChoice choice) Creates aIngredientHolderfromRecipeChoice.MaterialChoice.- Parameters:
slot- the position in the crafting table (0-8)choice- theRecipeChoice.MaterialChoiceinstance to createIngredientHolder- Returns:
- a
IngredientHolder
-
fromExactChoice
@NotNull public static @NotNull IngredientHolder fromExactChoice(int slot, @NotNull RecipeChoice.ExactChoice choice) Creates aIngredientHolderfromRecipeChoice.ExactChoice.- Parameters:
slot- the position in the crafting table (0-8)choice- theRecipeChoice.ExactChoiceinstance to createIngredientHolder- Returns:
- a
IngredientHolder
-
fromSingleItem
@NotNull public static @NotNull IngredientHolder fromSingleItem(int slot, @NotNull @NotNull ItemStack itemStack) Creates aIngredientHolderfrom the singleItemStack.- Parameters:
slot- the position in the crafting table (0-8)itemStack- theItemStackto 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
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
patterns
-