endstone/attribute

Classes

NameDescription
AttributeAll attribute types.
AttributeInstanceRepresents a mutable instance of an attribute and its associated modifiers and values.
AttributeModifierRepresents an attribute modifier.

Type Aliases

NameDescription
AttributeId

classAttribute

Defined in <endstone/attribute/attribute.h>

All attribute types.

Variables

NameDescription
HealthHealth of an entity.
FollowRangeRange at which an entity will follow others.
KnockbackResistanceResistance of an entity to knockback.
MovementSpeedMovement speed of an entity.
UnderwaterMovementSpeedMovement speed of an entity underwater.
LavaMovementSpeedMovement speed of an entity in lava.
AttackDamageAttack damage of an entity.
AbsorptionAbsorption of an entity.
LuckLuck bonus of an entity.
JumpStrengthStrength with which an entity will jump.
PlayerHungerHunger level of a player.
PlayerSaturationSaturation level of a player.
PlayerExhaustionExhaustion level of a player.
PlayerLevelExperience level of a player.
PlayerExperienceProgress toward the next experience level of a player.
ZombieSpawnReinforcementsChance of a zombie to spawn reinforcements.

varHealthstaticconstexpr

auto Health

Health of an entity.

varFollowRangestaticconstexpr

auto FollowRange

Range at which an entity will follow others.

varKnockbackResistancestaticconstexpr

auto KnockbackResistance

Resistance of an entity to knockback.

varMovementSpeedstaticconstexpr

auto MovementSpeed

Movement speed of an entity.

varUnderwaterMovementSpeedstaticconstexpr

auto UnderwaterMovementSpeed

Movement speed of an entity underwater.

varLavaMovementSpeedstaticconstexpr

auto LavaMovementSpeed

Movement speed of an entity in lava.

varAttackDamagestaticconstexpr

auto AttackDamage

Attack damage of an entity.

varAbsorptionstaticconstexpr

auto Absorption

Absorption of an entity.

varLuckstaticconstexpr

auto Luck

Luck bonus of an entity.

varJumpStrengthstaticconstexpr

auto JumpStrength

Strength with which an entity will jump.

varPlayerHungerstaticconstexpr

auto PlayerHunger

Hunger level of a player.

varPlayerSaturationstaticconstexpr

auto PlayerSaturation

Saturation level of a player.

varPlayerExhaustionstaticconstexpr

auto PlayerExhaustion

Exhaustion level of a player.

varPlayerLevelstaticconstexpr

auto PlayerLevel

Experience level of a player.

varPlayerExperiencestaticconstexpr

auto PlayerExperience

Progress toward the next experience level of a player.

varZombieSpawnReinforcementsstaticconstexpr

auto ZombieSpawnReinforcements

Chance of a zombie to spawn reinforcements.

classAttributeInstance

Defined in <endstone/attribute/attribute_instance.h>

Represents a mutable instance of an attribute and its associated modifiers and values.

Methods

NameDescription
~AttributeInstance
getTypeThe attribute type pertaining to this instance.
getBaseValueBase value of this instance before modifiers are applied.
setBaseValueSet the base value of this instance.
getValueGet the value of this instance after all associated modifiers have been applied.
getModifiersGet all modifiers present on this instance.
addModifierAdd a modifier to this instance.
removeModifierRemove a modifier from this instance.

meth~AttributeInstancevirtual

~AttributeInstance() =default

methgetTypeabstractconst

AttributeId getType() const =0

The attribute type pertaining to this instance.

Returns

TypeDescription
AttributeIdthe attribute type

methgetBaseValueabstractconst

float getBaseValue() const =0

Base value of this instance before modifiers are applied.

Returns

TypeDescription
floatbase value

methsetBaseValueabstract

void setBaseValue(float value) =0

Set the base value of this instance.

Parameters

NameTypeDescription
valuefloatnew base value

methgetValueabstractconst

float getValue() const =0

Get the value of this instance after all associated modifiers have been applied.

Returns

TypeDescription
floatthe total attribute value

methgetModifiersabstractconst

std::vector<AttributeModifier> getModifiers() const =0

Get all modifiers present on this instance.

Returns

TypeDescription
std::vector<AttributeModifier>a copied collection of all modifiers

methaddModifierabstract

void addModifier(const AttributeModifier& modifier) =0

Add a modifier to this instance.

Parameters

NameTypeDescription
modifierconst AttributeModifier&to add

methremoveModifierabstract

void removeModifier(const AttributeModifier& modifier) =0

Remove a modifier from this instance.

Parameters

NameTypeDescription
modifierconst AttributeModifier&to remove

classAttributeModifier

Defined in <endstone/attribute/attribute_modifier.h>

Represents an attribute modifier.

Enums

NameDescription
OperationOperation to be applied.

Methods

NameDescription
AttributeModifier
AttributeModifier
getUniqueIdGet the unique ID for this modifier.
getNameGet the name of this modifier.
getAmountGet the amount by which this modifier will apply the operation.
getOperationGet the operation this modifier will apply.

enumOperation

Operation

Operation to be applied.

Values

NameValueDescription
AddAdds (or subtracts) the specified amount to the base value.
MultiplyBaseMultiplies the current value of the attribute by (1 + x), where x is the sum of the modifiers' amounts.
MultiplyFor every modifier, multiplies the current value of the attribute by (1 + x), where x is the amount of the particular modifier.

Note

Functions the same as MultiplyBase if there is only a single modifier. However, for multiple modifiers it multiplies the modifiers rather than adding them.

methAttributeModifier

AttributeModifier(std::string name, float amount, Operation operation)

methAttributeModifier

AttributeModifier(std::string name, UUID uuid, float amount, Operation operation)

methgetUniqueIdconst

UUID getUniqueId() const

Get the unique ID for this modifier.

Returns

TypeDescription
UUIDunique id

methgetNameconst

std::string getName() const

Get the name of this modifier.

Returns

TypeDescription
std::stringname

methgetAmountconst

float getAmount() const

Get the amount by which this modifier will apply the operation.

Returns

TypeDescription
floatmodification amount

methgetOperationconst

Operation getOperation() const

Get the operation this modifier will apply.

Returns

TypeDescription
Operationoperation

typeAttributeId

Identifier<class Attribute> AttributeId

On this page