Attribute
endstone.attribute
¶
Classes relevant to attributes.
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. |
Attribute
¶
All attribute types.
Attributes:
| Name | Type | Description |
|---|---|---|
ABSORPTION |
Identifier[Attribute]
|
|
ATTACK_DAMAGE |
Identifier[Attribute]
|
|
FOLLOW_RANGE |
Identifier[Attribute]
|
|
HEALTH |
Identifier[Attribute]
|
|
JUMP_STRENGTH |
Identifier[Attribute]
|
|
KNOCKBACK_RESISTANCE |
Identifier[Attribute]
|
|
LAVA_MOVEMENT_SPEED |
Identifier[Attribute]
|
|
LUCK |
Identifier[Attribute]
|
|
MOVEMENT_SPEED |
Identifier[Attribute]
|
|
PLAYER_EXHAUSTION |
Identifier[Attribute]
|
|
PLAYER_EXPERIENCE |
Identifier[Attribute]
|
|
PLAYER_HUNGER |
Identifier[Attribute]
|
|
PLAYER_LEVEL |
Identifier[Attribute]
|
|
PLAYER_SATURATION |
Identifier[Attribute]
|
|
UNDERWATER_MOVEMENT_SPEED |
Identifier[Attribute]
|
|
ZOMBIE_SPAWN_REINFORCEMENTS |
Identifier[Attribute]
|
|
ABSORPTION
class-attribute
instance-attribute
¶
ABSORPTION: Identifier[Attribute] = 'minecraft:absorption'
ATTACK_DAMAGE
class-attribute
instance-attribute
¶
ATTACK_DAMAGE: Identifier[Attribute] = (
"minecraft:attack_damage"
)
FOLLOW_RANGE
class-attribute
instance-attribute
¶
FOLLOW_RANGE: Identifier[Attribute] = (
"minecraft:follow_range"
)
JUMP_STRENGTH
class-attribute
instance-attribute
¶
JUMP_STRENGTH: Identifier[Attribute] = (
"minecraft:jump_strength"
)
KNOCKBACK_RESISTANCE
class-attribute
instance-attribute
¶
KNOCKBACK_RESISTANCE: Identifier[Attribute] = (
"minecraft:knockback_resistance"
)
LAVA_MOVEMENT_SPEED
class-attribute
instance-attribute
¶
LAVA_MOVEMENT_SPEED: Identifier[Attribute] = (
"minecraft:lava_movement"
)
MOVEMENT_SPEED
class-attribute
instance-attribute
¶
MOVEMENT_SPEED: Identifier[Attribute] = "minecraft:movement"
PLAYER_EXHAUSTION
class-attribute
instance-attribute
¶
PLAYER_EXHAUSTION: Identifier[Attribute] = (
"minecraft:player.exhaustion"
)
PLAYER_EXPERIENCE
class-attribute
instance-attribute
¶
PLAYER_EXPERIENCE: Identifier[Attribute] = (
"minecraft:player.experience"
)
PLAYER_HUNGER
class-attribute
instance-attribute
¶
PLAYER_HUNGER: Identifier[Attribute] = (
"minecraft:player.hunger"
)
PLAYER_LEVEL
class-attribute
instance-attribute
¶
PLAYER_LEVEL: Identifier[Attribute] = (
"minecraft:player.level"
)
PLAYER_SATURATION
class-attribute
instance-attribute
¶
PLAYER_SATURATION: Identifier[Attribute] = (
"minecraft:player.saturation"
)
AttributeInstance
¶
Represents a mutable instance of an attribute and its associated modifiers and values.
Methods:
| Name | Description |
|---|---|
add_modifier |
Add a modifier to this instance. |
add_transient_modifier |
Add a transient modifier to this instance. Transient modifiers are not persisted (saved with the NBT data). |
get_modifier |
Gets the modifier with the corresponding id. |
remove_modifier |
|
Attributes:
| Name | Type | Description |
|---|---|---|
base_value |
float
|
Base value of this instance before modifiers are applied. |
max_value |
float
|
The maximum value this instance is allowed to take. Bedrock-specific. |
min_value |
float
|
The minimum value this instance is allowed to take. Bedrock-specific. |
modifiers |
list[AttributeModifier]
|
All modifiers present on this instance. |
type |
Identifier[Attribute]
|
The attribute type pertaining to this instance. |
value |
float
|
The value of this instance after all associated modifiers have been applied. |
base_value
property
writable
¶
base_value: float
Base value of this instance before modifiers are applied.
max_value
property
writable
¶
max_value: float
The maximum value this instance is allowed to take. Bedrock-specific.
min_value
property
writable
¶
min_value: float
The minimum value this instance is allowed to take. Bedrock-specific.
value
property
¶
value: float
The value of this instance after all associated modifiers have been applied.
add_modifier
¶
add_modifier(modifier: AttributeModifier) -> None
Add a modifier to this instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modifier
|
AttributeModifier
|
Modifier to add. |
required |
add_transient_modifier
¶
add_transient_modifier(modifier: AttributeModifier) -> None
Add a transient modifier to this instance. Transient modifiers are not persisted (saved with the NBT data).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modifier
|
AttributeModifier
|
Modifier to add. |
required |
get_modifier
¶
get_modifier(
id: Identifier[AttributeModifier] | str,
) -> AttributeModifier | None
Gets the modifier with the corresponding id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
Identifier[AttributeModifier] | str
|
The id of the modifier. |
required |
Returns:
| Type | Description |
|---|---|
AttributeModifier | None
|
The modifier, or |
remove_modifier
¶
remove_modifier(modifier: AttributeModifier) -> None
remove_modifier(
id: Identifier[AttributeModifier] | str,
) -> None
AttributeModifier
¶
AttributeModifier(
id: Identifier[AttributeModifier] | str,
amount: float,
operation: Operation,
)
Represents an attribute modifier.
Classes:
| Name | Description |
|---|---|
Operation |
Operation to be applied. |
Attributes:
| Name | Type | Description |
|---|---|---|
ADD |
|
|
CAP |
|
|
MULTIPLY |
|
|
MULTIPLY_BASE |
|
|
amount |
float
|
The amount by which this modifier will apply its operation. |
id |
Identifier[AttributeModifier]
|
The id of this modifier. |
operation |
Operation
|
The operation this modifier will apply. |
Operation
¶
Bases: Enum
Operation to be applied.
Attributes:
| Name | Type | Description |
|---|---|---|
ADD |
Adds (or subtracts) the specified amount to the base value. |
|
CAP |
Caps the value of the attribute at the modifier's amount. Bedrock-specific operation with no Bukkit equivalent. |
|
MULTIPLY |
For every modifier, multiplies the current value of the attribute by (1 + x), where x is the amount of the particular modifier. |
|
MULTIPLY_BASE |
Multiplies the current value of the attribute by (1 + x), where x is the sum of the modifiers' amounts. |
ADD
class-attribute
instance-attribute
¶
Adds (or subtracts) the specified amount to the base value.
CAP
class-attribute
instance-attribute
¶
Caps the value of the attribute at the modifier's amount. Bedrock-specific operation with no Bukkit equivalent.
MULTIPLY
class-attribute
instance-attribute
¶
For every modifier, multiplies the current value of the attribute by (1 + x), where x is the amount of the particular modifier.
MULTIPLY_BASE
class-attribute
instance-attribute
¶
Multiplies the current value of the attribute by (1 + x), where x is the sum of the modifiers' amounts.