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
FieldsModifier and TypeFieldDescriptionstatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attributestatic final Attribute -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the value of thedefaultValuerecord component.final booleanIndicates whether some other object is "equal to" this one.static @Nullable AttributeRetrieves an attribute by its key.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.floatmaxValue()Returns the value of themaxValuerecord component.@NotNull Attributeregister()Register this attribute.final StringtoString()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 aAttributerecord class.- Parameters:
key- the value for thekeyrecord componentdefaultValue- the value for thedefaultValuerecord componentmaxValue- the value for themaxValuerecord 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 thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
defaultValue
public float defaultValue()Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-
maxValue
public float maxValue()Returns the value of themaxValuerecord component.- Returns:
- the value of the
maxValuerecord component
-