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 DoubleUnaryOperator
ZERO_DAMAGE
-
Constructor Summary
Constructors Constructor Description DamageFunction(DamageModifier modifier)
Creates a newDamageFunction
with the providedDamageModifier
.DamageFunction(DamageModifier modifier, DoubleUnaryOperator function)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(@Nullable Object o)
DoubleUnaryOperator
function()
Gets theDoubleUnaryOperator
for this function.int
hashCode()
DamageModifier
modifier()
Gets theDamageModifier
for this function.static DamageFunction
of(DamageModifier first, DoubleUnaryOperator second)
Constructs a new damage function.String
toString()
-
-
-
Field Detail
-
ZERO_DAMAGE
public static final DoubleUnaryOperator ZERO_DAMAGE
-
-
Constructor Detail
-
DamageFunction
public DamageFunction(DamageModifier modifier)
Creates a newDamageFunction
with the providedDamageModifier
. The caveat is that the providedDamageFunction
is by default going to provide0
damage 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 theDamageModifier
for this function.- Specified by:
modifier
in interfaceModifierFunction<DamageModifier>
- Returns:
- The damage modifier
-
function
public DoubleUnaryOperator function()
Gets theDoubleUnaryOperator
for this function.- Specified by:
function
in interfaceModifierFunction<DamageModifier>
- Returns:
- The damage function
-
-