Interface ItemDamageFunction
Hold how much damage should be applied to the item from a given attack.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionfloat
base()
Get the constant amount of damage applied to the item, if threshold is passed.int
damageToApply
(float damage) Get the damage to apply for the item.float
factor()
Get the fraction of the dealt damage that should be applied to the item, if threshold is passed.static ItemDamageFunction.Builder
@org.checkerframework.checker.index.qual.NonNegative float
Get the minimum amount of damage dealt by the attack before item damage is applied to the item.
-
Method Details
-
itemDamageFunction
-
threshold
@org.checkerframework.checker.index.qual.NonNegative float threshold()Get the minimum amount of damage dealt by the attack before item damage is applied to the item.- Returns:
- the threshold
-
base
float base()Get the constant amount of damage applied to the item, if threshold is passed.- Returns:
- the base
-
factor
float factor()Get the fraction of the dealt damage that should be applied to the item, if threshold is passed.- Returns:
- the factor
-
damageToApply
int damageToApply(float damage) Get the damage to apply for the item.- Returns:
- the damage to apply
- API Note:
- this doesn't apply enchantments like
Enchantment.UNBREAKING
-