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

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

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

Methods

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.

Return Type: EntityTypePredicate

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

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.

Return Type: EntityTypePredicate

ZenScript
Copy
EntityTypePredicate.withType(type as MCEntityType) as EntityTypePredicate
ParameterTypeDescription
typeMCEntityTypeThe entity type this predicate should match.