Class CompoundFluidIngredient
java.lang.Object
net.neoforged.neoforge.fluids.crafting.FluidIngredient
net.neoforged.neoforge.fluids.crafting.CompoundFluidIngredient
- All Implemented Interfaces:
Predicate<FluidStack>
Fluid ingredient that matches if any of the child ingredients match.
This type additionally represents the array notation used in
FluidIngredient.CODEC internally.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<FluidIngredient> static final com.mojang.serialization.MapCodec
<CompoundFluidIngredient> Fields inherited from class net.neoforged.neoforge.fluids.crafting.FluidIngredient
OPTIONAL_STREAM_CODEC, STREAM_CODEC
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchildren()
boolean
Stream
<net.minecraft.core.Holder<net.minecraft.world.level.material.Fluid>> Returns a stream of fluids accepted by this ingredient.getType()
Returns The type of this fluid ingredient..int
hashCode()
boolean
isSimple()
Returns whether this fluid ingredient always requires direct stack testing.static FluidIngredient
of
(List<FluidIngredient> children) Creates a compound ingredient from the given list of ingredients.static FluidIngredient
of
(FluidIngredient... children) Creates a compound ingredient from the given list of ingredients.boolean
test
(FluidStack stack) Checks if a given fluid stack matches this ingredient.Methods inherited from class net.neoforged.neoforge.fluids.crafting.FluidIngredient
display, displayForSingleFluid, fluids, of, of, of, of
-
Field Details
-
CODEC
-
children
-
-
Constructor Details
-
CompoundFluidIngredient
-
-
Method Details
-
of
Creates a compound ingredient from the given list of ingredients. -
of
Creates a compound ingredient from the given list of ingredients. -
generateFluids
Description copied from class:FluidIngredient
Returns a stream of fluids accepted by this ingredient.For compatibility reasons, implementations should follow the same guidelines as for custom item ingredients, i.e.:
- Returned fluids are generally used for display purposes, and need not be exhaustive or perfectly accurate, as ingredients may additionally filter by e.g. data component values.
- An exception is ingredients that are simple,
for which it is important that this stream corresponds exactly all fluids accepted by
FluidIngredient.test(FluidStack)
! - At least one stack should always be returned, so that the ingredient is not considered empty. Empty ingredients may invalidate recipes!
Note: no caching needs to be done by the implementation, this is already handled by
FluidIngredient.fluids
!- Specified by:
generateFluids
in classFluidIngredient
- Returns:
- a stream of all fluid stacks this ingredient accepts.
Note: No guarantees are made as to the amount of the fluid, as FluidIngredients are generally not meant to match by amount and these stacks are mostly used for display.
- See Also:
-
test
Description copied from class:FluidIngredient
Checks if a given fluid stack matches this ingredient. The stack must not be modified in any way.- Specified by:
test
in interfacePredicate<FluidStack>
- Specified by:
test
in classFluidIngredient
- Parameters:
stack
- the stack to test- Returns:
true
if the stack matches,false
otherwise
-
isSimple
public boolean isSimple()Description copied from class:FluidIngredient
Returns whether this fluid ingredient always requires direct stack testing.- Specified by:
isSimple
in classFluidIngredient
- Returns:
true
if this ingredient ignores NBT data when matching stacks,false
otherwise- See Also:
-
getType
Description copied from class:FluidIngredient
Returns The type of this fluid ingredient..The type must be registered to
NeoForgeRegistries.FLUID_INGREDIENT_TYPES
.- Specified by:
getType
in classFluidIngredient
- Returns:
- The type of this fluid ingredient.
-
hashCode
public int hashCode()- Specified by:
hashCode
in classFluidIngredient
-
equals
- Specified by:
equals
in classFluidIngredient
-
children
-