Package net.minestom.server.attribute
Record Class Attribute
java.lang.Object
java.lang.Record
net.minestom.server.attribute.Attribute
Represents a
living entity
attribute.-
Field Summary
Modifier and TypeFieldDescriptionstatic final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
static final Attribute
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the value of thedefaultValue
record component.final boolean
Indicates whether some other object is "equal to" this one.static @Nullable Attribute
Retrieves an attribute by its key.final int
hashCode()
Returns a hash code value for this object.key()
Returns the value of thekey
record component.float
maxValue()
Returns the value of themaxValue
record component.@NotNull Attribute
register()
Register this attribute.final String
toString()
Returns a string representation of this record class.static @NotNull Collection
<@NotNull Attribute> values()
Retrieves all registered attributes.
-
Field Details
-
MAX_HEALTH
-
FOLLOW_RANGE
-
KNOCKBACK_RESISTANCE
-
MOVEMENT_SPEED
-
ATTACK_DAMAGE
-
ATTACK_SPEED
-
FLYING_SPEED
-
ARMOR
-
ARMOR_TOUGHNESS
-
ATTACK_KNOCKBACK
-
LUCK
-
HORSE_JUMP_STRENGTH
-
ZOMBIE_SPAWN_REINFORCEMENTS
-
-
Constructor Details
-
Attribute
Creates an instance of aAttribute
record class.- Parameters:
key
- the value for thekey
record componentdefaultValue
- the value for thedefaultValue
record componentmaxValue
- the value for themaxValue
record component
-
-
Method Details
-
register
Register this attribute.- Returns:
- this attribute
- See Also:
-
fromKey
Retrieves an attribute by its key.- Parameters:
key
- the key of the attribute- Returns:
- the attribute for the key or null if not any
-
values
Retrieves all registered attributes.- Returns:
- an array containing all registered attributes
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
key
Returns the value of thekey
record component.- Returns:
- the value of the
key
record component
-
defaultValue
public float defaultValue()Returns the value of thedefaultValue
record component.- Returns:
- the value of the
defaultValue
record component
-
maxValue
public float maxValue()Returns the value of themaxValue
record component.- Returns:
- the value of the
maxValue
record component
-