Class LivingConversionEvent.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.LivingConversionEvent
net.neoforged.neoforge.event.entity.living.LivingConversionEvent.Pre
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
LivingConversionEvent
public static class LivingConversionEvent.Pre
extends LivingConversionEvent
implements net.neoforged.bus.api.ICancellableEvent
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. To prevent it, the conversion
timer needs to be changed or reset
This event is
ICancellableEvent
If cancelled, the replacement will not occur-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingConversionEvent
LivingConversionEvent.Post, LivingConversionEvent.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
-
Constructor Summary
ConstructorDescriptionPre
(LivingEntity entity, EntityType<? extends LivingEntity> outcome, Consumer<Integer> timer) -
Method Summary
Modifier and TypeMethodDescriptionEntityType
<? extends LivingEntity> Gets the entity type of the new entity this living entity is converting tovoid
setConversionTimer
(int ticks) Sets the conversion timer, by changing this it prevents the event being triggered every tick Do note the timer of some of the entities are increments, but some of them are decrements Not every conversion is applicable for thisMethods inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
getEntity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
outcome
-
timer
-
-
Constructor Details
-
Pre
public Pre(LivingEntity entity, EntityType<? extends LivingEntity> outcome, Consumer<Integer> timer)
-
-
Method Details
-
getOutcome
Gets the entity type of the new entity this living entity is converting to- Returns:
- the entity type of the new entity
-
setConversionTimer
public void setConversionTimer(int ticks) Sets the conversion timer, by changing this it prevents the event being triggered every tick Do note the timer of some of the entities are increments, but some of them are decrements Not every conversion is applicable for this- Parameters:
ticks
- timer ticks
-