Class LivingDamageEvent.Post
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.living.LivingDamageEvent
net.neoforged.neoforge.event.entity.living.LivingDamageEvent.Post
- Enclosing class:
LivingDamageEvent
LivingDamageEvent.Post is fired after health is modified on the entity.
The fields in this event represent the FINAL values of what was applied to the entity.
Also note that appropriate resources (like armor durability and absorption extra hearts) have already been consumed.
This event is fired whenever an Entity is damaged in
This event is fired via
The fields in this event represent the FINAL values of what was applied to the entity.
Also note that appropriate resources (like armor durability and absorption extra hearts) have already been consumed.
This event is fired whenever an Entity is damaged in
LivingEntity#actuallyHurt(DamageSource, float)
This event is fired via
CommonHooks.onLivingDamagePost(LivingEntity, DamageContainer)
.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingDamageEvent
LivingDamageEvent.Post, LivingDamageEvent.Pre
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final float
private final float
private final float
private final int
private final EnumMap
<DamageContainer.Reduction, Float> private final float
private final DamageSource
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the amount of damage reduced by a blocking action.float
Returns the amount of health this entity lost during this sequence.float
Returns the original damage whenLivingEntity.hurt(net.minecraft.world.damagesource.DamageSource, float)
was invoked.int
Returns the number of ticks this entity will be invulnerable after this sequence.float
getReduction
(DamageContainer.Reduction reduction) float
Returns the amount of shield durability this entity lost if a blocking action was captured and the entity was holding a shield.Returns theDamageSource
for this damage sequence.Methods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
-
Field Details
-
originalDamage
private final float originalDamage -
source
-
newDamage
private final float newDamage -
blockedDamage
private final float blockedDamage -
shieldDamage
private final float shieldDamage -
postAttackInvulnerabilityTicks
private final int postAttackInvulnerabilityTicks -
reductions
-
-
Constructor Details
-
Post
-
-
Method Details
-
getOriginalDamage
public float getOriginalDamage()Returns the original damage whenLivingEntity.hurt(net.minecraft.world.damagesource.DamageSource, float)
was invoked.- Returns:
- the original damage when
LivingEntity.hurt(net.minecraft.world.damagesource.DamageSource, float)
was invoked
-
getSource
Returns theDamageSource
for this damage sequence.- Returns:
- the
DamageSource
for this damage sequence
-
getNewDamage
public float getNewDamage()Returns the amount of health this entity lost during this sequence.- Returns:
- the amount of health this entity lost during this sequence
-
getBlockedDamage
public float getBlockedDamage()Returns the amount of damage reduced by a blocking action.- Returns:
- the amount of damage reduced by a blocking action
-
getShieldDamage
public float getShieldDamage()Returns the amount of shield durability this entity lost if a blocking action was captured and the entity was holding a shield.- Returns:
- the amount of shield durability this entity lost if a blocking action was captured and the entity was holding a shield
-
getPostAttackInvulnerabilityTicks
public int getPostAttackInvulnerabilityTicks()Returns the number of ticks this entity will be invulnerable after this sequence.- Returns:
- the number of ticks this entity will be invulnerable after this sequence
-
getReduction
- Parameters:
reduction
- the type of reduction to obtain- Returns:
- the amount of damage reduced by this reduction type.
-