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
CODEC_NON_EMPTY, LIST_CODEC, LIST_CODEC_NON_EMPTY, MAP_CODEC_NONEMPTY, STREAM_CODEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchildren()booleanGenerates a stream of all fluid stacks this ingredient matches against.getType()Returns The type of this fluid ingredient..inthashCode()booleanisSimple()Returns whether this fluid ingredient always requires direct stack testing.static FluidIngredientof(List<FluidIngredient> children) Creates a compound ingredient from the given list of ingredients.static FluidIngredientof(Stream<FluidIngredient> stream) static FluidIngredientof(FluidIngredient... children) Creates a compound ingredient from the given list of ingredients.booleantest(FluidStack stack) Checks if a given fluid stack matches this ingredient.Methods inherited from class net.neoforged.neoforge.fluids.crafting.FluidIngredient
empty, getStacks, hasNoFluids, isEmpty, of, of, of, single, single, single, tag
-
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. -
of
-
generateStacks
Description copied from class:FluidIngredientGenerates a stream of all fluid stacks this ingredient matches against.For compatibility reasons, implementations should follow the same guidelines as for custom item ingredients, i.e.:
- These stacks are generally used for display purposes, and need not be exhaustive or perfectly accurate.
- An exception is ingredients that are simple,
for which it is important that the returned stacks correspond exactly to all the accepted
Fluids. - At least one stack should always be returned, otherwise the ingredient may be considered accidentally empty.
- The ingredient should try to return at least one stack with each accepted
Fluid. This allows mods that inspect the ingredient to figure out which stacks it might accept.
- Specified by:
generateStacksin 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:FluidIngredientChecks if a given fluid stack matches this ingredient. The stack must not be modified in any way.- Specified by:
testin interfacePredicate<FluidStack>- Specified by:
testin classFluidIngredient- Parameters:
stack- the stack to test- Returns:
trueif the stack matches,falseotherwise
-
isSimple
public boolean isSimple()Description copied from class:FluidIngredientReturns whether this fluid ingredient always requires direct stack testing.- Specified by:
isSimplein classFluidIngredient- Returns:
trueif this ingredient ignores NBT data when matching stacks,falseotherwise- See Also:
-
getType
Description copied from class:FluidIngredientReturns The type of this fluid ingredient..The type must be registered to
NeoForgeRegistries.FLUID_INGREDIENT_TYPES.- Specified by:
getTypein classFluidIngredient- Returns:
- The type of this fluid ingredient.
-
hashCode
public int hashCode()- Specified by:
hashCodein classFluidIngredient
-
equals
- Specified by:
equalsin classFluidIngredient
-
children
-