EntityEquipmentPredicate

Represents the predicate for an MCEntity’s equipment.

The predicate can be used to check any number and combination of items that are being used by the entity as armor or held as weapons, either in the main hand or in the off-hand, with the help of ItemPredicates.

By default, the entity passes the checks no matter its current equipment.

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.

script.zs
import crafttweaker.api.predicate.EntityEquipmentPredicate;

Extending AnyDefaultingVanillaWrappingPredicate

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

Methods

Creates and sets the ItemPredicate that will be used to match the entity’s chest armor slot.

Any changes that have been made previously to the item predicate will be discarded, if any.

Returns: The predicate itself for chaining.
Return Type: EntityEquipmentPredicate

script.zs
EntityEquipmentPredicate.withChestItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
ParameterTypeDescription
Parameter
builder
Type
Consumer<ItemPredicate>
Description
A consumer that will be used to configure the ItemPredicate.

Creates and sets the ItemPredicate that will be used to match the entity’s feet armor slot.

Any changes that have been made previously to the item predicate will be discarded, if any.

Returns: The predicate itself for chaining.
Return Type: EntityEquipmentPredicate

script.zs
EntityEquipmentPredicate.withFeetItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
ParameterTypeDescription
Parameter
builder
Type
Consumer<ItemPredicate>
Description
A consumer that will be used to configure the ItemPredicate.

Creates and sets the ItemPredicate that will be used to match the entity’s head armor slot.

Any changes that have been made previously to the item predicate will be discarded, if any.

Returns: The predicate itself for chaining.
Return Type: EntityEquipmentPredicate

script.zs
EntityEquipmentPredicate.withHeadItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
ParameterTypeDescription
Parameter
builder
Type
Consumer<ItemPredicate>
Description
A consumer that will be used to configure the ItemPredicate.

Creates and sets the ItemPredicate that will be used to match the item held in the entity’s hand.

It is assumed that the entity can carry items only in its main hand.

Any changes that have been made previously to the item predicate will be discarded, if any.

Returns: The predicate itself for chaining.
Return Type: EntityEquipmentPredicate

script.zs
EntityEquipmentPredicate.withItemInHand(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
ParameterTypeDescription
Parameter
builder
Type
Consumer<ItemPredicate>
Description
A consumer that will be used to configure the ItemPredicate.

Creates and sets the ItemPredicate that will be used to match the item held in the entity’s main hand.

Any changes that have been made previously to the item predicate will be discarded, if any.

Returns: The predicate itself for chaining.
Return Type: EntityEquipmentPredicate

script.zs
EntityEquipmentPredicate.withItemInMainHand(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
ParameterTypeDescription
Parameter
builder
Type
Consumer<ItemPredicate>
Description
A consumer that will be used to configure the ItemPredicate.

Creates and sets the ItemPredicate that will be used to match the item held in the entity’s off hand.

Any changes that have been made previously to the item predicate will be discarded, if any.

Returns: The predicate itself for chaining.
Return Type: EntityEquipmentPredicate

script.zs
EntityEquipmentPredicate.withItemInOffHand(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
ParameterTypeDescription
Parameter
builder
Type
Consumer<ItemPredicate>
Description
A consumer that will be used to configure the ItemPredicate.

Creates and sets the ItemPredicate that will be used to match the entity’s legs armor slot.

Any changes that have been made previously to the item predicate will be discarded, if any.

Returns: The predicate itself for chaining.
Return Type: EntityEquipmentPredicate

script.zs
EntityEquipmentPredicate.withLegsItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
ParameterTypeDescription
Parameter
builder
Type
Consumer<ItemPredicate>
Description
A consumer that will be used to configure the ItemPredicate.