attackEntity

open fun attackEntity(staffStack: ItemStack, world: World, attacker: LivingEntity, target: Entity, hand: Hand): EventResult(source)

Called on both the client by Fabric/Neo/Forge API and the server by Fabric/Neo/Forge API, when an entity attacks an entity with a staff.

Return

  • EventResult.interrupt, EventResult.interruptTrue, EventResult.interruptFalse, EventResult.interruptDefault: Cancels vanilla entity attack, and on the logical client, sends a packet to the server.

  • EventResult.pass: Lets Minecraft handle vanilla entity attack.

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

target

The entity the attacker attacked

hand

The hand of the attacker, in which the staff is