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

    Class EntityItemComponent

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

    world.afterEvents.entitySpawn.subscribe((event) => {
    const itemEntity = event.entity;
    if (itemEntity.typeId !== "minecraft:item") return;
    const item = itemEntity.getComponent("item");
    item.itemStack.setLore(["Hello Player"]);
    });

    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
    itemStack: ItemStack

    This property can throw errors.

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

    typeId: string