use On Entity
Called on both the client and the server by Minecraft, when an entity uses the staff on an entity. This method may not be called, if the entity handles the use event (for example, a horse). This method will not be called, if the player is in spectator mode.
On the logical client, the return values have the following meaning:
SUCCESS: send a packet to the server, emit entity interact game event, and swing hand
CONSUME, CONSUME_PARTIAL: send a packet to the server, emit entity interact game event, and don't swing hand
PASS, FAIL: send a packet to the server, don't emit entity interact game event, don't swing hand, then interact with the item by itself (see use)
On the logical server, the return values have the following meaning (if used by player):
SUCCESS: Emit entity interact game event, trigger player interacted with entity criteria, and swing hand
CONSUME, CONSUME_PARTIAL: Emit entity interact game event, trigger player interacted with entity criteria, and don't swing hand
PASS, FAIL: Don't emit entity interact game event, don't trigger player interacted with entity criteria, and don't swing hand
On the logical server, the return values are processed by the caller code (if not used by player).
Parameters
The item stack used to perform the action
The world the user is in
The entity, which used the staff
The entity, on which user used the staff