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

    PlayerHurtAfterEvent

    Basalt's own: EntityHurtAfterEvent for players alone.

    Interface in @minecraft/server

    Extends EntityHurtAfterEvent

    Basalt’s own: EntityHurtAfterEvent for players alone.

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

    Subscribe to it with world.afterEvents.playerHurt.

    import { world, type PlayerHurtAfterEvent } from '@minecraft/server';
    world.afterEvents.playerHurt.subscribe((event: PlayerHurtAfterEvent) => {
    console.log('playerHurt', event.hurtEntity.name, event.cancelKnockback, event.damage);
    });
    import { world } from '@minecraft/server';
    world.afterEvents.playerHurt.subscribe((event) => {
    console.log('playerHurt', event.hurtEntity.name, event.cancelKnockback, event.damage);
    });

    read-only

    readonly hurtEntity: Player;
    Types

    read-only

    readonly knockback: Vector3;
    Types

    read-only

    readonly cancelKnockback: boolean;

    WorldAfterEvents.playerHurt

    From EntityHurtAfterEvent: damage, damageSource