Script API - v26.60.30
    Preparing search index...

    Class PlayerItemAttackEntityBeforeEventBeta

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

    export class PlayerItemAttackEntityBeforeEvent {
    private constructor();
    readonly aimDirection?: Vector3;
    cancel: boolean;
    readonly itemStack?: ItemStack;
    readonly player: Player;
    readonly target: Entity;
    }
    Index
    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.

    This property can't be read in early-execution mode.

    cancel: boolean

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

    This property can't be read in early-execution mode.

    itemStack?: ItemStack

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

    This property can't be read in early-execution mode.

    player: Player

    The player that initiated the attack.

    This property can't be read in early-execution mode.

    target: Entity

    The entity targeted by the attack.

    This property can't be read in early-execution mode.