Item Attributes
onUseOnEntity
This attribute defines the script that is executed when the player right clicks an entity with the item. If the entity is a player, onUseOnPlayer is executed instead of onUseOnEntity.
Examples
onUseOnEntity[0] = "player.sendMessage('Right clicked an entity!');";