EntityInteractEvent
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
import crafttweaker.neoforge.api.event.interact.EntityInteractEvent;
Description
This event is fired on both sides whenever the player interacts with an entity.canceled will cause the entity to not be interacted with
Extends
EntityInteractEvent extends PlayerInteractEvent
.
Implements
EntityInteractEvent
implements the following interfaces:
Listening to the event
This event can be listened to like so:
events.register<crafttweaker.neoforge.api.event.interact.EntityInteractEvent>(event => { println("EntityInteractEvent ran!");});
Members
cancel()
Cancels the event. Same as script.zs
setCanceled(true)
// EntityInteract.cancel();event.cancel();
Getter
// EntityInteract.canceled as boolevent.canceled
Return Type:
bool
Setter
// EntityInteract.canceled = (cancel as bool);event.canceled = myBool;
Parameters:
cancel: bool
Type: bool
canceled() as bool
// EntityInteract.canceled() as bool;event.canceled();
Return Type:
bool
canceled(cancel as bool)
// EntityInteract.canceled(cancel as bool);event.canceled(myBool);
Parameters:
cancel: bool
Type: bool
Getter
// EntityInteract.cancellationResult as InteractionResultevent.cancellationResult
Return Type:
InteractionResult
Setter
Set the
Note that this only has an effect on RightClickBlockEvent, RightClickItemEvent, EntityInteractEvent.script.zs
InteractionResult
that will be returned to vanilla if the event is cancelled, instead of calling the relevant method of the event.Note that this only has an effect on RightClickBlockEvent, RightClickItemEvent, EntityInteractEvent.
event.cancellationResult = myInteractionResult;
Parameters:
result: InteractionResult
Type: InteractionResult
Getter
Getter
// EntityInteract.entity as LivingEntityevent.entity
Return Type:
LivingEntity
Getter
Getter
// EntityInteract.hand as InteractionHandevent.hand
Return Type:
InteractionHand
Getter
// EntityInteract.hasResult as boolevent.hasResult
Return Type:
bool
hasResult() as bool
// EntityInteract.hasResult() as bool;event.hasResult();
Return Type:
bool
Getter
The stack involved in this interaction. May be empty, but will never be null.script.zs
// EntityInteract.itemStack as IItemStackevent.itemStack
Return Type:
IItemStack
Getter
// EntityInteract.result as EventResultevent.result
Return Type:
EventResult
Setter
event.result = myResult;
Parameters:
result: EventResult
Type: EventResult
result() as Result
result(result as Result)
event.result(myResult);
Parameters:
result: EventResult
Type: EventResult
setAllow()
sets the event's result to script.zs
allow
// EntityInteract.setAllow();event.setAllow();
setDefault()
sets the event's result to script.zs
default
// EntityInteract.setDefault();event.setDefault();
setDeny()
sets the event's result to script.zs
deny
// EntityInteract.setDeny();event.setDeny();