@minecraft
    正在准备搜索索引...

    类 PlayerItemAttackEntityBeforeEvent实验性

    Contains information about an attack initiated through a player item interaction before it causes effects. Set cancel to true to prevent the attack.

    索引
    aimDirection?: Vector3

    The normalized world-space direction used for the attack. For standard client-initiated transaction attacks, this direction is derived from the client-provided hit position and the player's server-side eye position. Other attack paths can provide a server-derived direction. This property is undefined when the attack path does not provide an aim direction.

    cancel: boolean

    If set to true, the attack does not cause damage or other authoritative attack effects.

    itemStack?: ItemStack

    A snapshot of the item held by the attacking player. This property is undefined when the player holds no item.

    player: Player

    The player that initiated the attack.

    target: Entity

    The entity targeted by the attack.