Package net.neoforged.neoforge.event.entity.living
@ParametersAreNonnullByDefault
package net.neoforged.neoforge.event.entity.living
-
ClassDescriptionThis event is fired when an
Animal
is tamed.BabyEntitySpawnEvent is fired just before a baby entity is about to be spawned.Fires for each effect to allow modification or replacement of the particle options (you can set it to null to reset it to default).This event is fired on the forge bus before an Enderman detects that a player is looking at them.This event is fired beforeMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData)
is called.
This allows mods to control mob initialization.
In vanilla code, this event is injected by a transformer and not via patch, so calls cannot be traced via call hierarchy (it is not source-visible).LivingAttackEvent is fired when a living Entity is attacked.LivingBreatheEvent is fired whenever a living entity ticks.
This event is fired viaCommonHooks.onLivingBreathe(LivingEntity, int, int)
.
This event is notinvalid reference
ICancellableEvent
This event does not have a result.This event allows you to change the target an entity has.A living target type indicates what kind of system caused a change of targets.This enum contains two default living target types.LivingConversionEvent.Post is triggered when an entity is replacing itself with another entity.LivingConversionEvent.Pre is triggered when an entity is trying to replace itself with another entity This event may trigger every tick even if it was cancelled last tick for entities like Zombies and Hoglins.LivingDamageEvent is fired just before damage is applied to entity.
At this point armor, potion and absorption modifiers have already been applied to damage - this is FINAL value.
Also note that appropriate resources (like armor durability and absorption extra hearths) have already been consumed.
This event is fired whenever an Entity is damaged inLivingEntity#actuallyHurt(DamageSource, float)
andPlayer#actuallyHurt(DamageSource, float)
.
This event is fired via theCommonHooks.onLivingDamage(LivingEntity, DamageSource, float)
.
LivingDamageEvent.source
contains the DamageSource that caused this Entity to be hurt.LivingDeathEvent is fired when an Entity dies.Fired when the ender dragon or wither attempts to destroy a block and when ever a zombie attempts to break a door.LivingDropsEvent is fired when an Entity's death causes dropped items to appear.
This event is fired whenever an Entity dies and drops items inLivingEntity.die(DamageSource)
.
This event is fired via theCommonHooks.onLivingDrops(LivingEntity, DamageSource, Collection, int, boolean)
.
LivingDropsEvent.source
contains the DamageSource that caused the drop to occur.
LivingDropsEvent.drops
contains the ArrayList of EntityItems that will be dropped.
LivingDropsEvent.lootingLevel
contains the amount of loot that will be dropped.
LivingDropsEvent.recentlyHit
determines whether the Entity doing the drop has recently been damaged.
This event isICancellableEvent
.
If this event is canceled, the Entity does not drop anything.
This event does not have a result.LivingDrownEvent is fired whenever a living entity can't breathe and its air supply is less than or equal to zero.Fired after an item has fully finished being used.Fired when a player starts 'using' an item, typically when they hold right mouse.Fired when a player stops using an item without the use duration timing out.Fired every tick that a player is 'using' an item, seeLivingEntityUseItemEvent.Start
for info.LivingEquipmentChangeEvent
is fired when the Equipment of a Entity changes.LivingEvent is fired whenever an event involving aLivingEntity
occurs.
If a method utilizes thisEvent
as its parameter, the method will receive every child event of this class.
All children of this event are fired on theNeoForge.EVENT_BUS
.LivingJumpEvent is fired when an Entity jumps.
This event is fired whenever an Entity jumps inLivingEntity#jumpFromGround()
,MagmaCube#jumpFromGround()
,Slime#jumpFromGround()
,Camel#executeRidersJump()
, andAbstractHorse#executeRidersJump()
.
This event is fired via theCommonHooks.onLivingJump(LivingEntity)
.
This event is notICancellableEvent
.
This event does not have a result.Event for when an entity drops experience on its death, can be used to change the amount of experience points dropped or completely prevent dropping of experience by canceling the event.LivingFallEvent is fired when an Entity is set to be falling.
This event is fired whenever an Entity is set to fall inLivingEntity.causeFallDamage(float, float, DamageSource)
.
This event is fired via theCommonHooks.onLivingFall(LivingEntity, float, float)
.
LivingFallEvent.distance
contains the distance the Entity is to fall.This event is fired when a living entity attempts to get a projectile with theLivingEntity.getProjectile(ItemStack)
method.LivingHealEvent is fired when an Entity is set to be healed.LivingHurtEvent is fired when an Entity is set to be hurt.LivingKnockBackEvent is fired when a living entity is about to be knocked back.This event is fired when a living entity is about to swap the items in their main and offhand.Fired when an Entity attempts to use a totem to prevent its death.This event is fired fromMob.checkDespawn()
.
It fires once per tick per mob that is attempting to despawn.This event is fired when an interaction between aLivingEntity
andMobEffectInstance
happens.This event is fired when a newMobEffectInstance
is added to an entity.This event is fired to check if aMobEffectInstance
can be applied to an entity.This event is fired when aMobEffectInstance
expires on an entity.This Event is fired when aMobEffect
is about to get removed from an Entity.This class holds all events relating to the entire flow of mob spawns.
Currently, the events have the following flow for any given mob spawn:This event is fired when a mob checks for a valid spawn position, afterSpawnPlacements.checkSpawnRules(net.minecraft.world.entity.EntityType<T>, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.MobSpawnType, net.minecraft.core.BlockPos, net.minecraft.util.RandomSource)
has been evaluated.
Conditions validated here include the following: Obstruction - mobs inside blocks or fluids. Pathfinding - if the spawn block is valid for pathfinding. Sea Level - Ocelots check if the position is above sea level. Spawn Block - Ocelots check if the below block is grass or leaves.This event is fired when Spawn Placements (aka Spawn Rules) are checked, before a mob attempts to spawn.
Spawn Placement checks include light levels, slime chunks, grass blocks for animals, and others in the same vein.
The purpose of this event is to permit runtime changes to any or all spawn placement logic without having to wrap the placement for each entity.This event is fired whenever a mob is removed and splits into multiple children.The ShieldBlockEvent is fired when an entity successfully blocks with a shield.
Cancelling this event will have the same impact as if the shield was not eligible to block.
The damage blocked cannot be set lower than zero or greater than the original value.
Note: The shield item stack "should" be available fromLivingEntity.getUseItem()
at least for players.This event is fired fromNaturalSpawner.spawnCategoryForPosition(net.minecraft.world.entity.MobCategory, net.minecraft.server.level.ServerLevel, net.minecraft.core.BlockPos)
when the spawning system determines the maximum amount of the selected entity that can spawn at the same time.