Script API - v1.26.10.23
    Preparing search index...

    Class EntityHealthComponent

    import { system, world } from "@minecraft/server";

    system.runInterval(() => {
    const players = world.getPlayers();
    for (const player of players) {
    const health = player.getComponent("health");
    player.onScreenDisplay.setActionBar(`Health: ${health.currentValue} / ${health.effectiveMax}`);
    }
    });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    currentValue: number

    This property can throw errors.

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

    defaultValue: number

    This property can throw errors.

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

    effectiveMax: number

    This property can throw errors.

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

    effectiveMin: number

    This property can throw errors.

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

    entity: Entity

    This property can throw errors.

    InvalidEntityError

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

    isValid: boolean
    typeId: string

    Methods