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

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

Implemented Interfaces

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

Methods

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.

Return Type: EntityProperties

EntityProperties.withPredicate(builder as Consumer<EntityPredicate>) as EntityProperties
ParameterTypeDescription
builderConsumer<EntityPredicate>A consumer that will be used to configure the EntityPredicate.

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.

Return Type: EntityProperties

EntityProperties.withTargetedEntity(entity as TargetedEntity) as EntityProperties
ParameterTypeDescription
entityTargetedEntityThe entity that should be targeted.