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.

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
参数类型描述
参数
fluid
类型
MCFluid
描述
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
参数类型描述
参数
fluidTag
类型
MCTag<MCFluid>
描述
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
参数类型描述
参数
生成器
类型
Consumer<StatePropertiesPredicate>
描述
A consumer that will be used to configure the StatePropertiesPredicate.