attackBlock

public ActionResult attackBlock(ItemStack staffStack, World world, LivingEntity attacker, BlockPos target, Direction side, Hand hand)(source)

Called on both the client and the server by Architectury API, when an entity attacks a block with a staff.

Return

  • ActionResult.PASS: Lets Minecraft handle vanilla block breaking.

  • Anything else: Cancels vanilla block breaking, and on the logical client, sends a packet to the server.

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 block the attacker attacked

side

The side of the block, which was attacked

hand

The hand of the attacker, in which the staff is

See also