Builder to create an 'EntityScores' loot condition.

This condition checks the LootContext for an MCEntity that matches the targeted one, specified via TargetedEntity, and then tests its scoreboard properties against a set of values.

The condition passes if and only if there exists a valid entity to target and all the specified scoreboard entries are within the given bounds.

A valid 'EntityScores' loot condition has to specify a targeted entity. A well-formed 'EntityScores' condition must also specify at least one scoreboard property to check against. Not specifying any scoreboard values makes the condition simply act as a way to check for the presence of an entity of the given type.

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

已实现的接口

Link to 已实现的接口

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

Name: withExactScore

Adds the scoreboard property name to the ones that should be checked, making sure that the values matches exactly the given one.

If the scoreboard property had already some bounds specified, then the bounds will get overwritten.

This parameter is optional.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withExactScore(name as string, value as int) as EntityScores
参数类型描述
参数
name(名称)
类型
string
描述
The name of the scoreboard property to check.
参数
value
类型
int
描述
The exact value the scoreboard property must have.

Link to withMaximumScore

Name: withMaximumScore

Adds the scoreboard property name to the ones that should be checked, setting its maximum accepted value to max.

If the scoreboard property had already some bounds specified, then the maximum value of the bound will be overwritten with the new value specified in max. On the other hand, if the scoreboard property didn't have any specified bounds, the maximum value is set, leaving the lower end unbounded.

The maximum value is inclusive, meaning that a value that is equal to max will pass the check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withMaximumScore(name as string, max as int) as EntityScores
参数类型描述
参数
name(名称)
类型
string
描述
The name of the scoreboard property to check.
参数
max
类型
int
描述
The maximum value the scoreboard property can have.

Link to withMinimumScore

Name: withMinimumScore

Adds the scoreboard property name to the ones that should be checked, setting its minimum accepted value to min.

If the scoreboard property had already some bounds specified, then the minimum value of the bound will be overwritten with the new value specified in min. On the other hand, if the scoreboard property didn't have any specified bounds, the minimum value is set, leaving the upper end unbounded.

The minimum value is inclusive, meaning that a value that is equal to min will pass the check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withMinimumScore(name as string, min as int) as EntityScores
参数类型描述
参数
name(名称)
类型
string
描述
The name of the scoreboard property to check.
参数
min
类型
int
描述
The minimum value the scoreboard property can have.

Name: withRangedScore

Adds the scoreboard property name to the ones that should be checked, setting both its minimum and maximum accepted values respectively to min and max.

If the scoreboard property had already some bounds specified, then the bounds will get completely overwritten with the new values.

Both minimum and maximum values are inclusive, meaning that a value that is equal to either min or max will pass the check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withRangedScore(name as string, min as int, max as int) as EntityScores
参数类型描述
参数
name(名称)
类型
string
描述
The name of the scoreboard property to check.
参数
min
类型
int
描述
The minimum value the scoreboard property can have.
参数
max
类型
int
描述
The maximum value the scoreboard property can have.

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: EntityScores

ZenScript
Copy
EntityScores.withTargetedEntity(entity as TargetedEntity) as EntityScores
参数类型描述
参数
entity
类型
TargetedEntity
描述
The entity that should be targeted.