RightClickItemEvent
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.forge.api.player.interact.RightClickItemEvent;
Description
The rightClickItem event is fired whenever the player right clicks with an item in their hand. It does not offer any special getters, but you can still access all members fromPlayerInteractEvent
canceled Item#onItemRightClick will not be called
Extends
RightClickItemEvent extends PlayerInteractEvent
.
Listening to the event
This event can be listened to like so:
events.register<crafttweaker.forge.api.player.interact.RightClickItemEvent>(event => { println("RightClickItemEvent ran!");});
Members
cancel()
Cancels the event. Same as script.zs
setCanceled(true)
// RightClickItem.cancel();event.cancel();
Getter
// RightClickItem.cancelable as boolevent.cancelable
Return Type:
bool
cancelable() as bool
// RightClickItem.cancelable() as bool;event.cancelable();
Return Type:
bool
Getter
// RightClickItem.canceled as boolevent.canceled
Return Type:
bool
Setter
// RightClickItem.canceled = (cancel as bool);event.canceled = myBool;
Parameters:
cancel: bool
Type: bool
canceled() as bool
// RightClickItem.canceled() as bool;event.canceled();
Return Type:
bool
canceled(cancel as bool)
// RightClickItem.canceled(cancel as bool);event.canceled(myBool);
Parameters:
cancel: bool
Type: bool
Getter
// RightClickItem.cancellationResult as InteractionResultevent.cancellationResult
Return Type:
InteractionResult
Setter
Set the EnumActionResult 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.script.zs
Note that this only has an effect on RightClickBlockEvent, RightClickItemEvent, EntityInteractEvent.
event.cancellationResult = myInteractionResult;
Parameters:
result: InteractionResult
Type: InteractionResult
Getter
Getter
// RightClickItem.entity as LivingEntityevent.entity
Return Type:
LivingEntity
Getter
Getter
// RightClickItem.hand as InteractionHandevent.hand
Return Type:
InteractionHand
Getter
// RightClickItem.hasResult as boolevent.hasResult
Return Type:
bool
hasResult() as bool
// RightClickItem.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
// RightClickItem.itemStack as IItemStackevent.itemStack
Return Type:
IItemStack
Getter
// RightClickItem.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
// RightClickItem.setAllow();event.setAllow();
setDefault()
sets the event's result to script.zs
default
// RightClickItem.setDefault();event.setDefault();
setDeny()
sets the event's result to script.zs
deny
// RightClickItem.setDeny();event.setDeny();