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

    Class EntityColorComponent

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

    system.runInterval(() => {
    const players = world.getAllPlayers();
    for (const player of players) {
    const hits = player.getEntitiesFromViewDirection({ type: "minecraft:sheep" });
    for (const hit of hits) {
    const color = hit.entity.getComponent("color");
    player.sendMessage(`Sheep Color value: ${color.value}`);
    }
    }
    }, 1000);

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Constructors

    Properties

    entity: Entity

    This property can throw errors.

    InvalidEntityError

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

    isValid: boolean
    typeId: string
    value: number

    This property can't be edited in read-only mode.

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