Represents a predicate for a MCFluid.

This predicate will match a fluid state with either the given MCFluid or fluid tag (MCTag<T>), with the second check taking precedence over the first if they are both present. If this comparison succeeds, then the predicate may also verify additional fluid state properties via the supplied StatePropertiesPredicate.

By default, this predicate allows any fluid state to pass the checks without restrictions.

Importing the class

Link to importing-the-class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.predicate.FluidPredicate;

Extending AnyDefaultingVanillaWrappingPredicate

Link to extending-anydefaultingvanillawrappingpredicate

FluidPredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in FluidPredicate

Name: withFluid

Sets the fluid that this predicate should match.

If a tag to match against has already been set, then the tag check will take precedence over this check.

Returns: This predicate for chaining.
Return Type: FluidPredicate

ZenScript
Copy
FluidPredicate.withFluid(fluid as MCFluid) as FluidPredicate
ParameterTypeDescription
Parameter
fluid
Type
MCFluido
Description
The fluid the predicate should match.

Name: withFluidTag

Sets the tag that this predicate should use for matching.

The predicate will successfully match only if the supplied fluid state's fluid is contained within the given tag.

Specifying both a tag and a fluid to match against will make the tag take precedence over the fluid.

Returns: This predicate for chaining.
Return Type: FluidPredicate

ZenScript
Copy
FluidPredicate.withFluidTag(fluidTag as MCTag<MCFluid>) as FluidPredicate
ParameterTypeDescription
Parameter
fluidTag
Type
MCTag<MCFluid>
Description
The tag the predicate should use for matching.

Link to withStatePropertiesPredicate

Name: withStatePropertiesPredicate

Creates and sets the StatePropertiesPredicate that will be matched against the fluid state's properties.

Any changes that have already been made to the state properties predicate will be overwritten, effectively replacing the previous one, if any.

Returns: This predicate for chaining.
Return Type: FluidPredicate

ZenScript
Copy
FluidPredicate.withStatePropertiesPredicate(builder as Consumer<StatePropertiesPredicate>) as FluidPredicate
ParameterTypeDescription
Parameter
constructor
Type
Consumer<StatePropertiesPredicate>
Description
A consumer that will be used to configure the StatePropertiesPredicate.