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
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
Cancelable
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.LivingTickEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.EyeHeight, EntityEvent.Size
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
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.minecraftforge.event.entity.living.LivingEvent
getEntity
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
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
-