Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts
    Entity components

    EntityItemComponent

    Class in @minecraft/server

    Extends EntityComponent

    What an item entity holds.

    import { EntityItemComponent } from '@minecraft/server';
    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);
    }
    }

    read-only

    readonly typeId: "minecraft:item";

    read-only

    readonly itemStack: ItemStack | undefined;

    EntityComponentTypeMap.minecraft:item, EntityComponentTypeMap.item