endstone/attribute
Classes
| Name | Description |
|---|---|
Attribute | All attribute types. |
AttributeInstance | Represents a mutable instance of an attribute and its associated modifiers and values. |
AttributeModifier | Represents an attribute modifier. |
Type Aliases
| Name | Description |
|---|---|
AttributeId |
classAttribute
Defined in <endstone/attribute/attribute.h>
All attribute types.
Variables
| Name | Description |
|---|---|
Health | Health of an entity. |
FollowRange | Range at which an entity will follow others. |
KnockbackResistance | Resistance of an entity to knockback. |
MovementSpeed | Movement speed of an entity. |
UnderwaterMovementSpeed | Movement speed of an entity underwater. |
LavaMovementSpeed | Movement speed of an entity in lava. |
AttackDamage | Attack damage of an entity. |
Absorption | Absorption of an entity. |
Luck | Luck bonus of an entity. |
JumpStrength | Strength with which an entity will jump. |
PlayerHunger | Hunger level of a player. |
PlayerSaturation | Saturation level of a player. |
PlayerExhaustion | Exhaustion level of a player. |
PlayerLevel | Experience level of a player. |
PlayerExperience | Progress toward the next experience level of a player. |
ZombieSpawnReinforcements | Chance of a zombie to spawn reinforcements. |
varHealthstaticconstexpr
auto HealthHealth of an entity.
varFollowRangestaticconstexpr
auto FollowRangeRange at which an entity will follow others.
varKnockbackResistancestaticconstexpr
auto KnockbackResistanceResistance of an entity to knockback.
varMovementSpeedstaticconstexpr
auto MovementSpeedMovement speed of an entity.
varUnderwaterMovementSpeedstaticconstexpr
auto UnderwaterMovementSpeedMovement speed of an entity underwater.
varLavaMovementSpeedstaticconstexpr
auto LavaMovementSpeedMovement speed of an entity in lava.
varAttackDamagestaticconstexpr
auto AttackDamageAttack damage of an entity.
varAbsorptionstaticconstexpr
auto AbsorptionAbsorption of an entity.
varLuckstaticconstexpr
auto LuckLuck bonus of an entity.
varJumpStrengthstaticconstexpr
auto JumpStrengthStrength with which an entity will jump.
varPlayerHungerstaticconstexpr
auto PlayerHungerHunger level of a player.
varPlayerSaturationstaticconstexpr
auto PlayerSaturationSaturation level of a player.
varPlayerExhaustionstaticconstexpr
auto PlayerExhaustionExhaustion level of a player.
varPlayerLevelstaticconstexpr
auto PlayerLevelExperience level of a player.
varPlayerExperiencestaticconstexpr
auto PlayerExperienceProgress toward the next experience level of a player.
varZombieSpawnReinforcementsstaticconstexpr
auto ZombieSpawnReinforcementsChance 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
| Name | Description |
|---|---|
~AttributeInstance | |
getType | The attribute type pertaining to this instance. |
getBaseValue | Base value of this instance before modifiers are applied. |
setBaseValue | Set the base value of this instance. |
getValue | Get the value of this instance after all associated modifiers have been applied. |
getModifiers | Get all modifiers present on this instance. |
addModifier | Add a modifier to this instance. |
removeModifier | Remove a modifier from this instance. |
meth~AttributeInstancevirtual
~AttributeInstance() =defaultmethgetTypeabstractconst
AttributeId getType() const =0The attribute type pertaining to this instance.
Returns
| Type | Description |
|---|---|
AttributeId | the attribute type |
methgetBaseValueabstractconst
float getBaseValue() const =0Base value of this instance before modifiers are applied.
Returns
| Type | Description |
|---|---|
float | base value |
methsetBaseValueabstract
void setBaseValue(float value) =0Set the base value of this instance.
Parameters
| Name | Type | Description |
|---|---|---|
value | float | new base value |
methgetValueabstractconst
float getValue() const =0Get the value of this instance after all associated modifiers have been applied.
Returns
| Type | Description |
|---|---|
float | the total attribute value |
methgetModifiersabstractconst
std::vector<AttributeModifier> getModifiers() const =0Get all modifiers present on this instance.
Returns
| Type | Description |
|---|---|
std::vector<AttributeModifier> | a copied collection of all modifiers |
methaddModifierabstract
void addModifier(const AttributeModifier& modifier) =0Add a modifier to this instance.
Parameters
| Name | Type | Description |
|---|---|---|
modifier | const AttributeModifier& | to add |
methremoveModifierabstract
void removeModifier(const AttributeModifier& modifier) =0Remove a modifier from this instance.
Parameters
| Name | Type | Description |
|---|---|---|
modifier | const AttributeModifier& | to remove |
classAttributeModifier
Defined in <endstone/attribute/attribute_modifier.h>
Represents an attribute modifier.
Enums
| Name | Description |
|---|---|
Operation | Operation to be applied. |
Methods
| Name | Description |
|---|---|
AttributeModifier | |
AttributeModifier | |
getUniqueId | Get the unique ID for this modifier. |
getName | Get the name of this modifier. |
getAmount | Get the amount by which this modifier will apply the operation. |
getOperation | Get the operation this modifier will apply. |
enumOperation
OperationOperation to be applied.
Values
| Name | Value | Description |
|---|---|---|
Add | Adds (or subtracts) the specified amount to the base value. | |
MultiplyBase | Multiplies the current value of the attribute by (1 + x), where x is the sum of the modifiers' amounts. | |
Multiply | For 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() constGet the unique ID for this modifier.
Returns
| Type | Description |
|---|---|
UUID | unique id |
methgetNameconst
std::string getName() constGet the name of this modifier.
Returns
| Type | Description |
|---|---|
std::string | name |
methgetAmountconst
float getAmount() constGet the amount by which this modifier will apply the operation.
Returns
| Type | Description |
|---|---|
float | modification amount |
methgetOperationconst
Operation getOperation() constGet the operation this modifier will apply.
Returns
| Type | Description |
|---|---|
Operation | operation |
typeAttributeId
Identifier<class Attribute> AttributeId