Class DamageFunction
- java.lang.Object
-
- org.spongepowered.api.event.cause.entity.damage.DamageFunction
-
- All Implemented Interfaces:
ModifierFunction<DamageModifier>
public class DamageFunction extends Object implements ModifierFunction<DamageModifier>
-
-
Field Summary
Fields Modifier and Type Field Description static DoubleUnaryOperatorZERO_DAMAGE
-
Constructor Summary
Constructors Constructor Description DamageFunction(DamageModifier modifier)Creates a newDamageFunctionwith the providedDamageModifier.DamageFunction(DamageModifier modifier, DoubleUnaryOperator function)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(@Nullable Object o)DoubleUnaryOperatorfunction()Gets theDoubleUnaryOperatorfor this function.inthashCode()DamageModifiermodifier()Gets theDamageModifierfor this function.static DamageFunctionof(DamageModifier first, DoubleUnaryOperator second)Constructs a new damage function.StringtoString()
-
-
-
Field Detail
-
ZERO_DAMAGE
public static final DoubleUnaryOperator ZERO_DAMAGE
-
-
Constructor Detail
-
DamageFunction
public DamageFunction(DamageModifier modifier)
Creates a newDamageFunctionwith the providedDamageModifier. The caveat is that the providedDamageFunctionis by default going to provide0damage modifications.- Parameters:
modifier- The damage modifier
-
DamageFunction
public DamageFunction(DamageModifier modifier, DoubleUnaryOperator function)
- Parameters:
modifier- The modifierfunction- The function
-
-
Method Detail
-
of
public static DamageFunction of(DamageModifier first, DoubleUnaryOperator second)
Constructs a new damage function.- Parameters:
first- The damage modifier to usesecond- The unary operator to use- Returns:
- The resulting damage function
-
modifier
public DamageModifier modifier()
Gets theDamageModifierfor this function.- Specified by:
modifierin interfaceModifierFunction<DamageModifier>- Returns:
- The damage modifier
-
function
public DoubleUnaryOperator function()
Gets theDoubleUnaryOperatorfor this function.- Specified by:
functionin interfaceModifierFunction<DamageModifier>- Returns:
- The damage function
-
-