Record Class BrewingRecipeRegistry
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcore.api.brewing.BrewingRecipeRegistry
Internal registry for custom brewing recipes.
This registry stores all IBrewingRecipe instances and provides
utility methods for querying brewing outputs, inputs, and ingredients.
Usage:
- Brewing stands and their menus ask it alongside the game's own (data pack) recipes.
- For registration, use
RegisterBrewingRecipesEvent.
-
Constructor Summary
ConstructorsConstructorDescriptionBrewingRecipeRegistry(List<IBrewingRecipe> recipes) Creates an instance of aBrewingRecipeRegistryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.ItemStackgetOutput(net.minecraft.world.item.ItemStack input, net.minecraft.world.item.ItemStack ingredient) Gets the output of brewing the given input with the given ingredient.final inthashCode()Returns a hash code value for this object.booleanhasOutput(net.minecraft.world.item.ItemStack input, net.minecraft.world.item.ItemStack ingredient) Checks whether there is any recipe that produces an output for the given input and ingredient.booleanisValidIngredient(net.minecraft.world.item.ItemStack stack) Checks whether the givenItemStackis a valid ingredient for any recipe in this registry.booleanisValidInput(net.minecraft.world.item.ItemStack stack) Checks whether the givenItemStackis a valid input for any recipe in this registry.recipes()Returns the value of therecipesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BrewingRecipeRegistry
Creates an instance of aBrewingRecipeRegistryrecord class.- Parameters:
recipes- the value for therecipesrecord component
-
-
Method Details
-
getOutput
public net.minecraft.world.item.ItemStack getOutput(net.minecraft.world.item.ItemStack input, net.minecraft.world.item.ItemStack ingredient) Gets the output of brewing the given input with the given ingredient.If the input or ingredient is empty, or if the input stack count is not exactly 1, returns
ItemStack.EMPTY.- Parameters:
input- the brewing stand's bottom-slot itemingredient- the brewing stand's top-slot item- Returns:
- the resulting
ItemStack, orItemStack.EMPTYif no matching recipe exists
-
hasOutput
public boolean hasOutput(net.minecraft.world.item.ItemStack input, net.minecraft.world.item.ItemStack ingredient) Checks whether there is any recipe that produces an output for the given input and ingredient.- Parameters:
input- the brewing stand's bottom-slot itemingredient- the brewing stand's top-slot item- Returns:
trueif there is a matching recipe, otherwisefalse
-
isValidIngredient
public boolean isValidIngredient(net.minecraft.world.item.ItemStack stack) Checks whether the givenItemStackis a valid ingredient for any recipe in this registry.- Parameters:
stack- the item to test- Returns:
trueif it is a valid ingredient, otherwisefalse
-
isValidInput
public boolean isValidInput(net.minecraft.world.item.ItemStack stack) Checks whether the givenItemStackis a valid input for any recipe in this registry.- Parameters:
stack- the item to test- Returns:
trueif it is a valid input, otherwisefalse
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
recipes
Returns the value of therecipesrecord component.- Returns:
- the value of the
recipesrecord component
-