Class PlayerInteractEvent.RightClickBlock

Enclosing class:
PlayerInteractEvent

public static class PlayerInteractEvent.RightClickBlock extends PlayerInteractEvent
This event is fired on both sides whenever the player right clicks while targeting a block.
This event controls which of IForgeItem.onItemUseFirst(net.minecraft.world.item.ItemStack, net.minecraft.world.item.context.UseOnContext), BlockBehaviour.use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult), and Item.useOn(UseOnContext) will be called.
Canceling the event will cause none of the above three to be called.

Let result be the first non-pass return value of the above three methods, or pass, if they all pass.
Or PlayerInteractEvent.cancellationResult if the event is cancelled.
If result equals InteractionResult.PASS, we proceed to PlayerInteractEvent.RightClickItem.

There are various results to this event, see the getters below.
Note that handling things differently on the client vs server may cause desynchronizations!