EntityProperties

Link to entityproperties

Builder to create an 'EntityProperties' loot condition.

This condition checks the LootContext for an MCEntity that matches the targeted one, specified via TargetedEntity, along with some additional properties like world and origin. The entity, if present, is matched against an EntityPredicate which will be used to determine entity-specific properties.

The condition passes if and only if there exists a valid entity to target and the predicate matches.

A valid 'EntityProperties' loot condition has to specify a targeted entity. The predicate, on the other hand, is optional: a lack of predicate means that the condition will simply check for the presence of the targeted entity.

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.loot.conditions.vanilla.EntityProperties;

Implemented Interfaces

Link to implemented-interfaces

EntityProperties implements the following interfaces. That means all methods defined in these interfaces are also available in EntityProperties

Name: withPredicate

Creates and sets the EntityPredicate that will be matched against the targeted entity.

Any changes that have already been made to the predicate will be overwritten, effectively replacing the previous predicate, if any.

This parameter is optional.

Returns: This builder for chaining.
Return Type: EntityProperties

ZenScript
Copy
EntityProperties.withPredicate(builder as Consumer<EntityPredicate>) as EntityProperties
ParameterTypeDescription
Parameter
konstruktor
Type
Consumer<EntityPredicate>
Description
A consumer that will be used to configure the EntityPredicate.

Link to withTargetedEntity

Name: withTargetedEntity

Sets the entity that should be targeted by the loot condition.

Refer to TargetedEntity for a full list and their respective meaning.

This parameter is required.

Returns: This builder for chaining.
Return Type: EntityProperties

ZenScript
Copy
EntityProperties.withTargetedEntity(entity as TargetedEntity) as EntityProperties
ParameterTypeDescription
Parameter
entity
Type
TargetedEntity
Description
The entity that should be targeted.