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 a
DoubleUnaryOperator
such that the output will be the final damage
applied to the Entity
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder that createsDamageModifier
s, for use in both plugin and implementation requirements. -
Method Summary
Modifier and TypeMethodDescriptionstatic DamageModifier.Builder
builder()
Creates a newDamageModifier.Builder
for constructing aDamageModifier
.cause()
Gets the cause of thisDamageModifier
.Gets the contributingItemStackSnapshot
that provided the "reason" for thisDamageModifier
to exist.type()
Gets theDamageModifierType
for thisDamageModifier
.
-
Method Details
-
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
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
-