-
Notifications
You must be signed in to change notification settings - Fork 29
Attribute Properties
Attribute properties are additional pieces of information that can be attached to attributes. By default, PlayerEx implements five properties that can be used:
Does not currently do anything, but is there because I plan to use this property in addon mods and it may be useful for other developers. It defines a value from 0 to 1 that determines this attributes rarity or how valuable this attribute is (e.g. max health could be considered more valuable than, say, knockback resistance). If you make a new attribute, you should strongly consider adding this property to make sure your attribute can be fully utilised in any potential addon mods.
Like weight, these do not currently do anything but exist for future addon reasons. The minroll and maxroll properties define a minimum and maximum value (as well as a resultant range of values with the minimum value as its increment) that could potentially be used for loot or items to apply modifiers with random values. The minroll value should not go below the attribute's minValue tag, and the maxroll value should not exceed the attribute's maxValue tag. Again, you should strongly consider adding these properties to your attribute to make sure that it can be fully utilised by any potential addon mods.
This property changes how the attributes value may be displayed. By default, attributes with this property have a percent symbol (%
) appended to their displayed value. The value assigned to this property acts as a multiplier to the displayed value. For example, Evasion is stored as a value from 0 to 1, but is displayed as a value from 0% to 100%. In this case, the value assigned by this property is 100.
This is also a visual property and is essentially the same as the percent property, but without the percentage symbol. It defines a multiplier that is applied to the attribute's displayed value. For example, Movement Speed is stored as a value that defines how many blocks the player moves per tick. But the displayed value is how many blocks per second - since there are 20 ticks in a second, this property's value is 20.
Attribute properties can be useful for developers if you want to attach extra information to your attributes. In the dev environment, a property is simply a String that can be used as a key to check if an attribute contains it, and if it does the key can be used to get the relevant value. How you use the attribute property is up to you.