Class MobDespawnEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.MobSpawnEvent
net.neoforged.neoforge.event.entity.living.MobDespawnEvent
This event is fired from
It fires once per tick per mob that is attempting to despawn.
Mob.checkDespawn()
.It fires once per tick per mob that is attempting to despawn.
It is fired for all entities, including persistent entities. Additionally, it may be used to keep mobs from despawning in peaceful mode.
This event is only fired on the logical server.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.MobSpawnEvent
MobSpawnEvent.PositionCheck, MobSpawnEvent.SpawnPlacementCheck
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMobDespawnEvent
(Mob mob, ServerLevelAccessor level) Fire viaEventHooks.checkMobDespawn(Mob)
-
Method Summary
Modifier and TypeMethodDescriptionReturns the result of this event, which controls if the despawn will occur.void
setResult
(MobDespawnEvent.Result result) Changes the result of this event.
-
Field Details
-
result
-
-
Constructor Details
-
MobDespawnEvent
Fire viaEventHooks.checkMobDespawn(Mob)
-
-
Method Details
-
setResult
Changes the result of this event. -
getResult
Returns the result of this event, which controls if the despawn will occur.- Returns:
- the result of this event, which controls if the despawn will occur
-