Interface DamageModifier
-
public interface DamageModifier
Represents a modifier that will apply a function on a damage value to deal towards an entity such that the raw damage is the input of aDoubleUnaryOperator
such that the output will be the final damage applied to theEntity
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DamageModifier.Builder
A builder that createsDamageModifier
s, for use in both plugin and implementation requirements.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static DamageModifier.Builder
builder()
Creates a newDamageModifier.Builder
for constructing aDamageModifier
.Cause
cause()
Gets the cause of thisDamageModifier
.java.util.Optional<ItemStackSnapshot>
contributingItem()
Gets the contributingItemStackSnapshot
that provided the "reason" for thisDamageModifier
to exist.DamageModifierType
type()
Gets theDamageModifierType
for thisDamageModifier
.
-
-
-
Method Detail
-
builder
static DamageModifier.Builder builder()
Creates a newDamageModifier.Builder
for constructing aDamageModifier
.- Returns:
- A new builder
-
type
DamageModifierType type()
Gets theDamageModifierType
for thisDamageModifier
.- Returns:
- The damage modifier type
-
cause
Cause cause()
Gets the cause of thisDamageModifier
.- Returns:
- The cause of this damage modifier
-
contributingItem
java.util.Optional<ItemStackSnapshot> contributingItem()
Gets the contributingItemStackSnapshot
that provided the "reason" for thisDamageModifier
to exist. An example of a contributingItemStack
is if anItemTypes.DIAMOND_SWORD
provided anEnchantment
that provided aDamageModifierTypes.WEAPON_ENCHANTMENT
, this modifier would have theItemStackSnapshot
for the weapon used. Some modifiers however, do not require anItemStack
to be the contributing factor for this modifier to exist.- Returns:
- The contributing item, if available
-
-