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.


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.

import crafttweaker.api.predicate.EntityTypePredicate;

Extending AnyDefaultingVanillaWrappingPredicate

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



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

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


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

EntityTypePredicate.withType(type as MCEntityType) as EntityTypePredicate
类型MCEntityType #MC实体类型The entity type this predicate should match.