EntityEquipmentPredicate

Link to 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.

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

Extending AnyDefaultingVanillaWrappingPredicate

Link to extending-anydefaultingvanillawrappingpredicate

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

Name: withChestItem

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

ZenScript
Copy
EntityEquipmentPredicate.withChestItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
参数类型描述
参数
生成器
类型
Consumer<ItemPredicate>
描述
A consumer that will be used to configure the ItemPredicate.

Name: withFeetItem

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

ZenScript
Copy
EntityEquipmentPredicate.withFeetItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
参数类型描述
参数
生成器
类型
Consumer<ItemPredicate>
描述
A consumer that will be used to configure the ItemPredicate.

Name: withHeadItem

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

ZenScript
Copy
EntityEquipmentPredicate.withHeadItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
参数类型描述
参数
生成器
类型
Consumer<ItemPredicate>
描述
A consumer that will be used to configure the ItemPredicate.

Name: withItemInHand

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

ZenScript
Copy
EntityEquipmentPredicate.withItemInHand(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
参数类型描述
参数
生成器
类型
Consumer<ItemPredicate>
描述
A consumer that will be used to configure the ItemPredicate.

Link to withItemInMainHand

Name: withItemInMainHand

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

ZenScript
Copy
EntityEquipmentPredicate.withItemInMainHand(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
参数类型描述
参数
生成器
类型
Consumer<ItemPredicate>
描述
A consumer that will be used to configure the ItemPredicate.

Link to withItemInOffHand

Name: withItemInOffHand

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

ZenScript
Copy
EntityEquipmentPredicate.withItemInOffHand(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
参数类型描述
参数
生成器
类型
Consumer<ItemPredicate>
描述
A consumer that will be used to configure the ItemPredicate.

Name: withLegsItem

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

ZenScript
Copy
EntityEquipmentPredicate.withLegsItem(builder as Consumer<ItemPredicate>) as EntityEquipmentPredicate
参数类型描述
参数
生成器
类型
Consumer<ItemPredicate>
描述
A consumer that will be used to configure the ItemPredicate.