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.

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

Implemented Interfaces

Link to implemented-interfaces

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

Name: withExactScore

Adds the scoreboard property <code>name</code> 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 <strong>optional</strong>.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withExactScore(name as string, value as int) as EntityScores
ParameterTypeDescription
Parameter
name
Type
string
Description
The name of the scoreboard property to check.
Parameter
value
Type
int
Description
The exact value the scoreboard property must have.

Name: withMaximumScore

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

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 <code>max</code>. 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 <code>max</code> will pass the check.

This parameter is <strong>optional</strong>.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withMaximumScore(name as string, max as int) as EntityScores
ParameterTypeDescription
Parameter
name
Type
string
Description
The name of the scoreboard property to check.
Parameter
max
Type
int
Description
The maximum value the scoreboard property can have.

Name: withMinimumScore

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

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 <code>min</code>. 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 <code>min</code> will pass the check.

This parameter is <strong>optional</strong>.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withMinimumScore(name as string, min as int) as EntityScores
ParameterTypeDescription
Parameter
name
Type
string
Description
The name of the scoreboard property to check.
Parameter
min
Type
int
Description
The minimum value the scoreboard property can have.

Name: withRangedScore

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

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 <code>min</code> or <code>max</code> will pass the check.

This parameter is <strong>optional</strong>.

Returns: This builder for chaining.
Return Type: EntityScores

ZenScript
Copy
EntityScores.withRangedScore(name as string, min as int, max as int) as EntityScores
ParameterTypeDescription
Parameter
name
Type
string
Description
The name of the scoreboard property to check.
Parameter
min
Type
int
Description
The minimum value the scoreboard property can have.
Parameter
max
Type
int
Description
The maximum value the scoreboard property can have.

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 <strong>required</strong>.

Returns: This builder for chaining.
Return Type: EntityScores

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