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
    Item components

    ItemInventoryComponent

    Class in @minecraft/server

    Extends ItemComponent

    The slots inside an item: a shulker box’s 27.

    import { ItemInventoryComponent } from '@minecraft/server';
    import { ItemStack, type ItemInventoryComponent } from '@minecraft/server';
    const item = new ItemStack('minecraft:diamond_sword');
    const component: ItemInventoryComponent | undefined = item.getComponent('minecraft:inventory');
    if (component) {
    console.log(item.typeId, component.typeId);
    }
    import { ItemStack } from '@minecraft/server';
    const item = new ItemStack('minecraft:diamond_sword');
    const component = item.getComponent('minecraft:inventory');
    if (component) {
    console.log(item.typeId, component.typeId);
    }

    static read-only

    static readonly componentId = "minecraft:inventory";

    read-only

    readonly container: Container;

    Read only in Basalt: changing a slot throws.

    ItemComponentTypeMap.inventory, ItemComponentTypeMap.minecraft:inventory

    From ItemComponent: typeId, isValid