EntityTypePredicate

Link to entitytypepredicate

Represents the predicate for an MCEntity's type.

This predicate will check an entity's type against either a tag (MCTag<T>) or a MCEntityType directly. The first check will override the second if they are both present.

By default, any entity type is valid for this predicate.

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.EntityTypePredicate;

Extending AnyDefaultingVanillaWrappingPredicate

Link to extending-anydefaultingvanillawrappingpredicate

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

Name: withTag

Sets the MCTag<T> that this predicate should use for matching the entity's type.

The predicate will match successfully only if the given entity type is part of the given tag.

Specifying both a tag and an entity type to check against will make the tag override the direct type comparison.

Returns: This predicate for chaining.
Return Type: EntityTypePredicate

ZenScript
Copy
EntityTypePredicate.withTag(tag as MCTag<MCEntityType>) as EntityTypePredicate
ParameterTypeDescription
Parameter
tag
Type
MCTag<MCEntityType>
Description
The tag the predicate should use for matching.

Name: withType

Sets the MCEntityType that this predicate should match exactly.

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

Returns: This predicate for chaining.
Return Type: EntityTypePredicate

ZenScript
Copy
EntityTypePredicate.withType(type as MCEntityType) as EntityTypePredicate
ParameterTypeDescription
Parameter
type
Type
MCEntityType
Description
The entity type this predicate should match.