Class LivingConversionEvent.Pre
- java.lang.Object
-
- net.minecraftforge.eventbus.api.Event
-
- net.minecraftforge.event.entity.EntityEvent
-
- net.minecraftforge.event.entity.living.LivingEvent
-
- net.minecraftforge.event.entity.living.LivingConversionEvent
-
- net.minecraftforge.event.entity.living.LivingConversionEvent.Pre
-
- Enclosing class:
- LivingConversionEvent
public static class LivingConversionEvent.Pre extends LivingConversionEvent
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 isCancelable
If cancelled, the replacement will not occur
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.living.LivingConversionEvent
LivingConversionEvent.Post, LivingConversionEvent.Pre
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingUpdateEvent, LivingEvent.LivingVisibilityEvent
-
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.CanUpdate, EntityEvent.EnteringChunk, EntityEvent.EntityConstructing, EntityEvent.Size
-
-
Field Summary
Fields Modifier and Type Field Description private EntityType<? extends LivingEntity>
outcome
private java.util.function.Consumer<java.lang.Integer>
timer
-
Constructor Summary
Constructors Constructor Description Pre(LivingEntity entity, EntityType<? extends LivingEntity> outcome, java.util.function.Consumer<java.lang.Integer> timer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EntityType<? extends LivingEntity>
getOutcome()
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 this-
Methods inherited from class net.minecraftforge.event.entity.living.LivingEvent
getEntityLiving
-
Methods inherited from class net.minecraftforge.event.entity.EntityEvent
getEntity
-
-
-
-
Field Detail
-
outcome
private final EntityType<? extends LivingEntity> outcome
-
timer
private final java.util.function.Consumer<java.lang.Integer> timer
-
-
Constructor Detail
-
Pre
public Pre(LivingEntity entity, EntityType<? extends LivingEntity> outcome, java.util.function.Consumer<java.lang.Integer> timer)
-
-
Method Detail
-
getOutcome
public EntityType<? extends LivingEntity> 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
-
-