Skip to main content

dev.plexusmodloader.api.content.attribute

Generated

This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.

TypeKindDescription
AttributeDefinitionrecordA mod attribute: a number every entity in scope carries, which modifiers raise or lower, like the game's minecraft:max_health or minecraft:luck.
AttributeHandleinterfaceA declared mod attribute; pass id() to LivingEntityView.attribute and its relatives.
AttributeOperationenumHow an attribute modifier changes the value.
AttributeScopeenumWhich entities carry a mod attribute.

AttributeDefinition​

record · Stability PREVIEW · Since next release

public record AttributeDefinition(double defaultValue, double minValue, double maxValue, boolean syncedToClients, AttributeScope scope)

A mod attribute: a number every entity in scope carries, which modifiers raise or lower, like the game's minecraft:max_health or minecraft:luck. Its name comes from attribute.name.<mod id>.<path>. Read and change it with LivingEntityView.attribute, setAttributeBase and addAttributeModifier, or with the game's /attribute command.

The game keeps the value inside [minValue, maxValue] after modifiers. Entities save their base value and permanent modifiers with the world.

ComponentTypeDescription
defaultValuedoublebase value of an entity that never changed it
minValuedoublelowest value
maxValuedoublehighest value
syncedToClientsbooleanwhether clients learn the value of the entities they see (needed only when client code reads it)
scopeAttributeScopewhich entities carry it

AttributeDefinition(double, double, double, boolean, AttributeScope)​

public AttributeDefinition(double defaultValue, double minValue, double maxValue, boolean syncedToClients, AttributeScope scope)

Since next release

ParameterTypeDescription
defaultValuedouble—
minValuedouble—
maxValuedouble—
syncedToClientsboolean—
scopeAttributeScope—

Throws IllegalArgumentException — when a value is not finite, minValue > maxValue, or the default is outside the range

of(double, double, double)​

public static AttributeDefinition of(double defaultValue, double minValue, double maxValue)

Since next release

An attribute every living entity carries, not synchronised to clients.

ParameterTypeDescription
defaultValuedouble—
minValuedouble—
maxValuedouble—

Returns AttributeDefinition

withClientSync()​

public AttributeDefinition withClientSync()

Since next release

The same definition, synchronised to clients.

Returns AttributeDefinition

withScope(AttributeScope)​

public AttributeDefinition withScope(AttributeScope newScope)

Since next release

The same definition, carried only by newScope.

ParameterTypeDescription
newScopeAttributeScope—

Returns AttributeDefinition

AttributeHandle​

interface · Stability PREVIEW · Since next release

public interface AttributeHandle extends ContentHandle

A declared mod attribute; pass id() to LivingEntityView.attribute and its relatives.

Supertypes: ContentHandle

AttributeOperation​

enum · Stability PREVIEW · Since next release

public enum AttributeOperation

How an attribute modifier changes the value. The game applies every ADD_VALUE to the base first, then ADD_MULTIPLIED_BASE, then ADD_MULTIPLIED_TOTAL, and keeps the result inside the attribute's range.

ConstantDescription
ADD_VALUEAdds the amount to the base.
ADD_MULTIPLIED_BASEAdds base * amount, using the base after every ADD_VALUE.
ADD_MULTIPLIED_TOTALMultiplies the running value by 1 + amount.

AttributeScope​

enum · Stability PREVIEW · Since next release

public enum AttributeScope

Which entities carry a mod attribute.

ConstantDescription
PLAYERSPlayers only.
LIVING_ENTITIESEvery living entity: players, the game's mobs, armour stands, and mod mobs.
Buy me a coffee