use

open fun use(staffStack: ItemStack, world: World, user: PlayerEntity, hand: Hand): TypedActionResult<ItemStack>(source)

Called on both the client and the server by Minecraft when the player uses the staff.

If the staff can be used for multiple ticks, override maxUseTime to return a positive number, and call PlayerEntity.setCurrentHand on user with hand as the argument.

On the logical client, the return values have the following meaning:

  • SUCCESS: Swing hand, and reset equip progress

  • CONSUME, CONSUME_PARTIAL: Don't swing hand, and reset equip progress

  • PASS, FAIL: Don't swing hand, and don't reset equip progress

On the logical server, the return values have the following meaning (if used by player):

  • SUCCESS: Swing hand

  • CONSUME, CONSUME_PARTIAL, PASS, FAIL: Don't swing hand

Parameters

staffStack

The item stack used to perform the action

world

The world the user is in

user

The player, which uses the staff

hand

The hand of the user, in which the staff is

See also