LivingConversionPreEvent

Link to livingconversionpreevent

The event 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.

The event is cancelable.

If the event is canceled, the replacement will not occur

The event does not have a result.

Importing the class

Link to importing-the-class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.event.living.conversion.LivingConversionPreEvent;

Extending LivingConversionEvent

Link to extending-livingconversionevent

LivingConversionPreEvent extends LivingConversionEvent. That means all methods available in LivingConversionEvent are also available in LivingConversionPreEvent

Name: getOutcome

Return Type: EntityType

ZenScript
Copy
// LivingConversionPreEvent.getOutcome() as EntityType

myLivingConversionPreEvent.getOutcome();

Link to setConversionTimer

Name: setConversionTimer

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

ZenScript
Copy
LivingConversionPreEvent.setConversionTimer(ticks as int)
ParameterType
Parameter
ticks
Type
int
NameTypeHas GetterHas Setter
Name
outcome
Type
EntityType
Has Getter
true
Has Setter
false