-
Notifications
You must be signed in to change notification settings - Fork 18
API 1.17.1
CleverNucleus edited this page Jan 14, 2022
·
1 revision
Data Attributes includes an API package located at com.github.clevernucleus.dataattributes.api. The package includes:
attribute.AdditionFunction.javaattribute.AttributeBehaviour.javaattribute.IAttribute.javaattribute.IAttributeFunction.javaevent.EntityAttributeEvents.javaAPI.java
public final class
-
publicstaticfinalStringMODID- Global access to Data Attribute's modid.
-
publicstaticSupplier<EntityAttribute>#getAttribute(Identifier attribute)- A method that provides a way to statically initialise a reference to an entity attribute that may or may not exist in a given scenario at a given time, due to the nature of datapacks.
-
publicstaticdouble#add(double current, double adding, double limit)- A maths method that calculates diminishing additions, see Behaviour.
public interface
-
double#add(double current, double adding, double limit)- A functional interface equivalent to a TriFunction, used to add a layer of abstraction to function behaviours.
public enum
-
FLAT- Reference to the
FLATbehaviour for attribute functions.
- Reference to the
-
DIMINISHING- Reference to the
DIMINISHINGbehaviour for attribute functions.
- Reference to the
-
publicstaticAttributeBehaviour#fromId(byte id)- Takes a byte id and returns the corresponding behaviour type.
-
publicbyte#id()- Returns the byte id of the behaviour.
-
publicdouble#result(double current, double adding, double limit)- Runs the inputs through the correct function for the specific behaviour type.
public interface
-
double#getDefaultValue()- Returns the entity attribute's default value.
-
double#getMinValue()- Returns the entity attribute's minimum value.
-
double#getMaxValue()- Returns the entity attribute's maximum value.
-
double#clamp(double value)- Returns the input value if it is between the minimum and maximum values, else returns the minimum or maximum values.
-
String#getTranslationKey()- Returns the entity attribute's translation key.
-
Collection<String>#properties()- Returns an immutable set of all the properties' keys assigned to this attribute.
-
boolean#hasProperty(String property)- Returns true if this entity attribute has the input property.
-
float#getProperty(String property)- Returns the input property's value if it exists, if not returns 0.
-
Collection<IAttributeFunction>#functions()- Returns an immutable set of all the attribute functions attached to this entity attribute.
public interface
-
Identifier#attribute()- Returns the registry key associated with this function's attribute.
-
AttributeBehaviour#behaviour()- Returns the behaviour type associated with this function..
-
double#multiplier()- Returns the multiplier associated with this function.
public final class
-
publicstaticfinalEvent<...>MODIFIER_ADDED_PRE- Fired before an
EntityAttributeModifieris applied to anEntityAttributeInstance. Allows for the value of the modifier to be changed before it is applied.
- Fired before an
-
publicstaticfinalEvent<...>MODIFIER_ADDED_POST- Fired after an
EntityAttributeModifierhas been applied to anEntityAttributeInstance.
- Fired after an
-
publicstaticfinalEvent<...>MODIFIER_REMOVED_PRE- Fired before an
EntityAttributeModifieris removed from anEntityAttributeInstance.
- Fired before an
-
publicstaticfinalEvent<...>MODIFIER_REMOVED_POST- Fired after an
EntityAttributeModifierhas been removed from anEntityAttributeInstance.
- Fired after an