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.DoubleUnaryOperator
ZERO_DAMAGE
-
Constructor Summary
Constructors Constructor Description DamageFunction(DamageModifier modifier)
Creates a newDamageFunction
with 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 boolean
equals(@Nullable java.lang.Object o)
java.util.function.DoubleUnaryOperator
function()
Gets theDoubleUnaryOperator
for this function.int
hashCode()
DamageModifier
modifier()
Gets theDamageModifier
for this function.static DamageFunction
of(DamageModifier first, java.util.function.DoubleUnaryOperator second)
Constructs a new damage function.java.lang.String
toString()
-
-
-
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, 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 theDamageModifier
for this function.- Specified by:
modifier
in interfaceModifierFunction<DamageModifier>
- Returns:
- The damage modifier
-
function
public java.util.function.DoubleUnaryOperator function()
Gets theDoubleUnaryOperator
for this function.- Specified by:
function
in interfaceModifierFunction<DamageModifier>
- Returns:
- The damage function
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-