Class AbstractAttackEntityEvent
java.lang.Object
org.spongepowered.api.event.impl.AbstractEvent
org.spongepowered.api.event.impl.entity.AbstractModifierEvent<DamageFunction,DamageModifier>
 
org.spongepowered.api.event.impl.entity.AbstractAttackEntityEvent
- All Implemented Interfaces:
- Cancellable,- AttackEntityEvent,- Event
public abstract class AbstractAttackEntityEvent
extends AbstractModifierEvent<DamageFunction,DamageModifier>
implements AttackEntityEvent 
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected doubleprotected doubleprotected List<DamageFunction>Fields inherited from class org.spongepowered.api.event.impl.entity.AbstractModifierEventmodifierFunctions, modifiers, originalFinalAmount, originalModifierMap, originalModifiersFields inherited from class org.spongepowered.api.event.impl.AbstractEventcurrentOrderFields inherited from interface org.spongepowered.api.event.entity.AttackEntityEventABSORPTION, BOOTS, CHESTPLATE, CREATOR, GENERAL_ARMOR, HARD_HAT_ARMOR, HELMET, LEGGINGS, NOTIFIER, RESISTANCE, SHIELD, SOURCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddDamageModifierAfter(DamageModifier damageModifier, DoubleUnaryOperator function, Set<DamageModifierType> after) Adds the providedDamageModifierandFunctionto the list of modifiers, such that the modifier will appear in order after any current modifiers whose type are included in the providedSetofDamageModifierTypes.voidaddDamageModifierBefore(DamageModifier damageModifier, DoubleUnaryOperator function, Set<DamageModifierType> before) Adds the providedDamageModifierandFunctionto the list of modifiers, such that theSetcontainingDamageModifierTypes provided inbeforewill appear after the provided damage modifier.doubleGets the "base" damage to deal to the targetedEntity.protected DamageFunctionconvertTuple(DamageModifier obj, DoubleUnaryOperator function) final doubleGets the final damage that will be passed into the proceedingAttackEntityEvent.protected final voidinit()Called once all fields have been set by the generated constructor in a subclass.final booleanisModifierApplicable(DamageModifier damageModifier) Checks whether the providedDamageModifieris applicable to the current availableDamageModifiers.Gets the modifiers affecting this event.final Map<DamageModifier,Double> Gets an immutableMapof all originalDamageModifiers and their associated "modified" damage.final doubleGets the original "final" amount of damage after all originalDamageModifiers are applied toAttackEntityEvent.originalDamage().final doubleoriginalModifierDamage(DamageModifier damageModifier) Gets the original damage for the providedDamageModifier.final doubleoutputDamage(DamageModifier damageModifier) Gets the damage for the providedDamageModifier.final voidsetBaseOutputDamage(double baseDamage) Sets the "base" damage to deal to the targetedEntity.final voidsetOutputDamage(DamageModifier damageModifier, DoubleUnaryOperator function) Sets the providedFunctionto be used for the givenDamageModifier.Methods inherited from class org.spongepowered.api.event.impl.entity.AbstractModifierEventfinalAmount, init, recalculateDamagesMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.spongepowered.api.event.entity.AttackEntityEvententity, knockbackModifier, originalDamage, originalFunctions, setKnockbackModifierMethods inherited from interface org.spongepowered.api.event.CancellableisCancelled, setCancelled
- 
Field Details- 
originalDamageprotected double originalDamage
- 
originalFunctions
- 
baseDamageprotected double baseDamage
 
- 
- 
Constructor Details- 
AbstractAttackEntityEventpublic AbstractAttackEntityEvent()
 
- 
- 
Method Details- 
initprotected final void init()Description copied from class:AbstractEventCalled once all fields have been set by the generated constructor in a subclass.This method should be used to initialize any fields that depend on parameters passed to the constructor. - Overrides:
- initin class- AbstractEvent
 
- 
originalModifierDamageDescription copied from interface:AttackEntityEventGets the original damage for the providedDamageModifier. If the providedDamageModifierwas not included inAttackEntityEvent.originalDamages(), anIllegalArgumentExceptionis thrown.- Specified by:
- originalModifierDamagein interface- AttackEntityEvent
- Parameters:
- damageModifier- The original damage modifier
- Returns:
- The original damage change
 
- 
originalFinalDamagepublic final double originalFinalDamage()Description copied from interface:AttackEntityEventGets the original "final" amount of damage after all originalDamageModifiers are applied toAttackEntityEvent.originalDamage(). The "final" damage is considered the amount of health being lost by theEntity, if health is tracked.- Specified by:
- originalFinalDamagein interface- AttackEntityEvent
- Returns:
- The final amount of damage to originally deal
 
- 
originalDamagesDescription copied from interface:AttackEntityEventGets an immutableMapof all originalDamageModifiers and their associated "modified" damage. Note that ordering is not retained.- Specified by:
- originalDamagesin interface- AttackEntityEvent
- Returns:
- An immutable map of the original modified damages
 
- 
finalOutputDamagepublic final double finalOutputDamage()Description copied from interface:AttackEntityEventGets the final damage that will be passed into the proceedingAttackEntityEvent. The final damage is the end result of theAttackEntityEvent.baseOutputDamage()being applied inFunction.apply(Object)available from all theTuples ofDamageModifiertoFunctioninAttackEntityEvent.originalFunctions().- Specified by:
- finalOutputDamagein interface- AttackEntityEvent
- Returns:
- The final damage to deal
 
- 
isModifierApplicableDescription copied from interface:AttackEntityEventChecks whether the providedDamageModifieris applicable to the current availableDamageModifiers.- Specified by:
- isModifierApplicablein interface- AttackEntityEvent
- Parameters:
- damageModifier- The damage modifier to check
- Returns:
- True if the damage modifier is relevant to this event
 
- 
outputDamageDescription copied from interface:AttackEntityEventGets the damage for the providedDamageModifier. Providing thatAttackEntityEvent.isModifierApplicable(DamageModifier)returnstrue, the cached "damage" for theDamageModifieris returned.- Specified by:
- outputDamagein interface- AttackEntityEvent
- Parameters:
- damageModifier- The damage modifier to get the damage for
- Returns:
- The modifier
 
- 
setOutputDamageDescription copied from interface:AttackEntityEventSets the providedFunctionto be used for the givenDamageModifier. If theDamageModifieris already included inAttackEntityEvent.modifiers(), theFunctionreplaces the existing function. If there is noTuplefor theDamageModifier, a new one is created and added to the end of the list ofFunctions to be applied to theAttackEntityEvent.baseOutputDamage().If needing to create a custom DamageModifieris required, usage of theDamageModifier.Builderis recommended.- Specified by:
- setOutputDamagein interface- AttackEntityEvent
- Parameters:
- damageModifier- The damage modifier
- function- The function to map to the modifier
 
- 
addDamageModifierBeforepublic void addDamageModifierBefore(DamageModifier damageModifier, DoubleUnaryOperator function, Set<DamageModifierType> before) Description copied from interface:AttackEntityEventAdds the providedDamageModifierandFunctionto the list of modifiers, such that theSetcontainingDamageModifierTypes provided inbeforewill appear after the provided damage modifier.- Specified by:
- addDamageModifierBeforein interface- AttackEntityEvent
- Parameters:
- damageModifier- The damage modifier to add
- function- The associated function
- before- The set containing the modifier types to come after the provided modifier
 
- 
addDamageModifierAfterpublic void addDamageModifierAfter(DamageModifier damageModifier, DoubleUnaryOperator function, Set<DamageModifierType> after) Description copied from interface:AttackEntityEventAdds the providedDamageModifierandFunctionto the list of modifiers, such that the modifier will appear in order after any current modifiers whose type are included in the providedSetofDamageModifierTypes.- Specified by:
- addDamageModifierAfterin interface- AttackEntityEvent
- Parameters:
- damageModifier- The damage modifier to add
- function- The associated function
- after- The set of modifier types to come before the new modifier
 
- 
baseOutputDamagepublic double baseOutputDamage()Description copied from interface:AttackEntityEventGets the "base" damage to deal to the targetedEntity. The "base" damage is the original value before passing along the chain ofFunctions for all knownDamageModifiers.- Specified by:
- baseOutputDamagein interface- AttackEntityEvent
- Returns:
- The base damage
 
- 
setBaseOutputDamagepublic final void setBaseOutputDamage(double baseDamage) Description copied from interface:AttackEntityEventSets the "base" damage to deal to the targetedEntity. The "base" damage is the original value before passing along the chain ofFunctions for all knownDamageModifiers.- Specified by:
- setBaseOutputDamagein interface- AttackEntityEvent
- Parameters:
- baseDamage- The base damage
 
- 
convertTuple- Specified by:
- convertTuplein class- AbstractModifierEvent<DamageFunction,- DamageModifier> 
 
- 
modifiersDescription copied from class:AbstractModifierEventGets the modifiers affecting this event.- Specified by:
- modifiersin interface- AttackEntityEvent
- Overrides:
- modifiersin class- AbstractModifierEvent<DamageFunction,- DamageModifier> 
- Returns:
- The list of modifiers
 
 
-