Class in @minecraft/server
Extends EntityComponent
What an item entity holds.
import { EntityItemComponent } from '@minecraft/server';Example
Section titled “Example”import { world, type EntityItemComponent } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const component: EntityItemComponent | undefined = player.getComponent('minecraft:item'); if (component) { console.log(player.name, component.itemStack?.typeId); }}import { world } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const component = player.getComponent('minecraft:item'); if (component) { console.log(player.name, component.itemStack?.typeId); }}Properties
Section titled “Properties”typeId
Section titled “typeId”read-only
readonly typeId: "minecraft:item";itemStack
Section titled “itemStack”read-only
readonly itemStack: ItemStack | undefined;Types
Used by
Section titled “Used by”EntityComponentTypeMap.minecraft:item, EntityComponentTypeMap.item