boolean leftClick = (event.action == Action.LEFT_CLICK_BLOCK);
boolean rightClick = (event.action == Action.RIGHT_CLICK_BLOCK);
// Interact with attachments.
if (leftClick || rightClick) {
IHasAttachments hasAttachments =
WorldUtils.get(world, x, y, z, IHasAttachments.class);
if (hasAttachments != null) {
EnumAttachmentInteraction interactionType =
((event.action == Action.LEFT_CLICK_BLOCK)
? EnumAttachmentInteraction.attack
: EnumAttachmentInteraction.use);
if (hasAttachments.getAttachments().interact(WorldUtils.rayTrace(player, 1.0F),
player, interactionType)) {
event.useBlock = Result.DENY;
event.useItem = Result.DENY;
}
}