Interface ItemDamageFunction


@NullMarked @Experimental @NonExtendable public interface ItemDamageFunction
Hold how much damage should be applied to the item from a given attack.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Builder for ItemDamageFunction.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    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
    Get the fraction of the dealt damage that should be applied to the item, if threshold is passed.
     
    @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

      @Contract(value="-> new", pure=true) static ItemDamageFunction.Builder 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