I’ve tried InteractBlockEntity.Secondary.Mainhand, but this only works when the player is facing a block in reach. I.e. right clicking into the air doesn’t trigger the event.
I know this possible within Minecraft. E.g. Hypixel lobby navigation by right clicking the compass. WorldEdit in Sponge also has this (/farwand gives you a wand that you right click to select far distances out of reach)
How would I go about doing this? Specifically, I want something to occur when a sword is right clicked.