Interface AttackEntityEvent
- All Superinterfaces:
Cancellable
,DamageCalculationEvent
,Event
- All Known Subinterfaces:
AttackEntityEvent.Post
,AttackEntityEvent.Pre
Entity
is being "attacked".
The uniqueness of this event is that all DamageSource
s can deal
varying amounts of damage with varying modifiers based on various reasons.
Due to this ambiguous variety of information that is possible to provide,
the AttackEntityEvent
can be summarized as so:
An ArrowLike
,
that was shot by a Skeleton
,
with an enchanted ItemTypes.BOW
ItemStack
,
when the World
Difficulty
was set to
Difficulties.HARD
,
will deal possibly "5" damage to any Entity
it hits.
The issue with representing this type of "logic flow" is that a
particular amount of damage from a DamageSource
, even if specified
to a particular DamageType
, has no static finalized amount of damage
to deal to a particular Entity
. To properly represent this,
a DamageSource
has various "states" such as:
DamageSource.isMagic()
, or DamageSource.isBypassingArmor()
.
Quite simply, the DamageSource
will always be the "first" element
within a Cause
that can be retrieved from Event.cause()
.
Next, any additional "aides" in attacking the Entity
will
be included in order of "priority of relation" to "attacking" the entity. In
short, if another Entity
is considered a "team member" to the
attacking Entity
, the "team member" may be a second element within
the Cause
. The same can be said if an ArrowLike
was shot from
a Dispenser
that was triggered by a Player
flipping a
switch.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Fires after the damage steps and their side effects have been applied.static interface
Fires before the damage steps and their side effects are applied. -
Method Summary
Methods inherited from interface org.spongepowered.api.event.Cancellable
isCancelled, setCancelled
Methods inherited from interface org.spongepowered.api.event.entity.DamageCalculationEvent
baseDamage, entity