Class LivingDamageEvent.Pre
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.Pre
- Enclosing class:
LivingDamageEvent
LivingDamageEvent.Pre is fired when an Entity is set to be hurt.
At this point armor, and potion modifiers have already been applied to the damage value and the entity. Absorption modifiers are handled after this event.
This event is fired in
For custom posting of this event, the event expects to be fired after damage reductions have been calculated but before any changes to the entity health has been applied. This event expects a mutable
This event is fired via the
At this point armor, and potion modifiers have already been applied to the damage value and the entity. Absorption modifiers are handled after this event.
This event is fired in
LivingEntity#actuallyHurt(DamageSource, float
For custom posting of this event, the event expects to be fired after damage reductions have been calculated but before any changes to the entity health has been applied. This event expects a mutable
DamageContainer
.
This event is fired via the
CommonHooks.onLivingDamagePre(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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPre
(net.minecraft.world.entity.LivingEntity entity, DamageContainer container) -
Method Summary
Modifier and TypeMethodDescriptionReturns theDamageContainer
instance for this damage sequence.float
Returns the current value to be applied to the entity's health after this event.float
Returns the original damage amount from the damage source.net.minecraft.world.damagesource.DamageSource
Returns the damage source for this damage sequence.void
setNewDamage
(float newDamage) Sets the amount to reduce the entity health byMethods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
-
Field Details
-
container
-
-
Constructor Details
-
Pre
-
-
Method Details
-
getContainer
Returns theDamageContainer
instance for this damage sequence.- Returns:
- the
DamageContainer
instance for this damage sequence
-
getSource
public net.minecraft.world.damagesource.DamageSource getSource()Returns the damage source for this damage sequence.- Returns:
- the damage source for this damage sequence
-
getNewDamage
public float getNewDamage()Returns the current value to be applied to the entity's health after this event.- Returns:
- the current value to be applied to the entity's health after this event
-
getOriginalDamage
public float getOriginalDamage()Returns the original damage amount from the damage source.- Returns:
- the original damage amount from the damage source
-
setNewDamage
public void setNewDamage(float newDamage) Sets the amount to reduce the entity health by- Parameters:
newDamage
- the new damage value
-