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.
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
.
Implements
RightClickItemEvent
implements the following interfaces:
Listening to the event
This event can be listened to like so:
Members
Getter
If the interaction was on an entity, will be a BlockPos centered on the entity. If the interaction was on a block, will be the position of that block. Otherwise, will be a BlockPos centered on the player.
Return Type:
BlockPos
cancel()
Cancels the event. Same as
setCanceled(true)
Getter
Return Type:
bool
Setter
Parameters:
cancel: bool
Type: bool
canceled() as bool
Return Type:
bool
canceled(cancel as bool)
Parameters:
cancel: bool
Type: bool
Getter
Return Type:
InteractionResult
Setter
Set the
Note that this only has an effect on RightClickBlockEvent, RightClickItemEvent, EntityInteractEvent.
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.
Parameters:
result: InteractionResult
Type: InteractionResult
Getter
The face involved in this interaction. For all non-block interactions, this will return null
Return Type:
Direction
Getter
Return Type:
InteractionHand
Getter
The stack involved in this interaction. May be empty, but will never be null.
Return Type:
IItemStack