Class DamageFunction
- java.lang.Object
-
- org.spongepowered.api.event.cause.entity.damage.DamageFunction
-
- All Implemented Interfaces:
ModifierFunction<DamageModifier>
public class DamageFunction extends java.lang.Object implements ModifierFunction<DamageModifier>
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.DoubleUnaryOperatorZERO_DAMAGE
-
Constructor Summary
Constructors Constructor Description DamageFunction(DamageModifier modifier)Creates a newDamageFunctionwith the providedDamageModifier.DamageFunction(DamageModifier modifier, java.util.function.DoubleUnaryOperator function)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(@Nullable java.lang.Object o)java.util.function.DoubleUnaryOperatorfunction()Gets theDoubleUnaryOperatorfor this function.inthashCode()DamageModifiermodifier()Gets theDamageModifierfor this function.static DamageFunctionof(DamageModifier first, java.util.function.DoubleUnaryOperator second)Constructs a new damage function.java.lang.StringtoString()
-
-
-
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, java.util.function.DoubleUnaryOperator function)
- Parameters:
modifier- The modifierfunction- The function
-
-
Method Detail
-
of
public static DamageFunction of(DamageModifier first, java.util.function.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 java.util.function.DoubleUnaryOperator function()
Gets theDoubleUnaryOperatorfor this function.- Specified by:
functionin interfaceModifierFunction<DamageModifier>- Returns:
- The damage function
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-