EntityInteractEvent

This event is fired on both sides whenever the player interacts with an entity.

The event is cancelable.

If the event is canceled, will cause the entity to not be interacted with

The event does not have a result.

Importing the class

Importing the class is recommended for events, simply add this line to the top of your script file.

script.zs
import crafttweaker.forge.api.event.interact.EntityInteractEvent;

Supertype

EntityInteractEvent extends PlayerInteractEvent. That means all methods available in PlayerInteractEvent are also available in EntityInteractEvent

Listening to the event

script.zs
events.register<crafttweaker.forge.api.event.interact.EntityInteractEvent>(event => {
println("EntityInteractEvent ran!");
});

Properties

NameTypeHas GetterHas Setter
Name
target
Type
Entity
Has Getter
true
Has Setter
false