Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts
    After events

    TargetBlockHitAfterEvent

    Interface in @minecraft/server

    A projectile hit a target block. Basalt gives no source, and 0 as the power before.

    import type { TargetBlockHitAfterEvent } from '@minecraft/server';

    Subscribe to it with world.afterEvents.targetBlockHit.

    import { world, type TargetBlockHitAfterEvent } from '@minecraft/server';
    world.afterEvents.targetBlockHit.subscribe((event: TargetBlockHitAfterEvent) => {
    console.log('targetBlockHit', event.block.typeId, event.dimension.id, event.previousRedstonePower);
    });
    import { world } from '@minecraft/server';
    world.afterEvents.targetBlockHit.subscribe((event) => {
    console.log('targetBlockHit', event.block.typeId, event.dimension.id, event.previousRedstonePower);
    });

    read-only

    readonly block: Block;
    Types

    read-only

    readonly dimension: Dimension;

    read-only

    readonly previousRedstonePower: number;

    read-only

    readonly redstonePower: number;

    read-only

    readonly source: Entity | undefined;
    Types

    WorldAfterEvents.targetBlockHit, TargetBlockHitAfterEventSignal.subscribe, TargetBlockHitAfterEventSignal.unsubscribe