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"]);}); Copy
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"]);});
Private
Readonly
This property can throw errors.
InvalidEntityError
This property can't be read in early-execution mode.
Example: setLoreOnItemEntity.js