attack

open fun attack(staffStack: ItemStack, world: World, attacker: LivingEntity, hand: Hand): ActionResult(source)

Called on both the client and the server by Staff Mod, when an entity attacks nothing (left clicks on air).

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

  • SUCCESS: send a packet to the server, and swing hand. This doesn't reset attack cooldown

  • CONSUME, CONSUME_PARTIAL: send a packet to the server, and don't swing hand. This doesn't reset attack cooldown

  • PASS: Let Minecraft handle vanilla attack

  • FAIL: don't send a packet to the server, and don't swing hand. This doesn't reset attack cooldown

On the logical server, the return value is ignored (if used by player) or processed by the caller code (if the attacker is not a player).

Parameters

staffStack

The item stack used to perform the action

world

The world the attacker is in

attacker

The entity, which attacked with the staff

hand

The hand of the attacker, in which the staff is