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

    Class in @minecraft/server

    A live handle on one slot of a container or equipment, correct as the item in it changes.

    import { ContainerSlot } from '@minecraft/server';

    read-only

    readonly isValid: boolean;

    Whether the slot is still usable.

    read-only

    readonly amount: number;

    How many items are in the slot, or 0 when it’s empty.

    read-only optional

    readonly typeId?: string;

    The item’s identifier, or undefined when the slot is empty.

    read-only

    readonly type: ItemType;

    The slot’s item type, whose id is typeId.

    optional

    nameTag?: string;

    The item’s custom name, or undefined.

    read-only

    readonly maxAmount: number;

    How many of the item fit in one slot.

    read-only

    readonly isStackable: boolean;

    Whether the item stacks above 1.

    keepOnDeath: boolean;

    Whether the item stays with a player who dies.

    lockMode: ItemLockMode;

    How the item is held in place.

    getItem(): ItemStack | undefined;

    The item in the slot, or undefined if it’s empty.

    Returns
    ItemStack | undefined
    setItem(itemStack?: ItemStack): void;

    Puts an item in the slot, or empties it when given no item.

    Parameters
    itemStackoptional
    ItemStack
    hasItem(): boolean;

    Whether the slot holds an item.

    Returns
    boolean
    isStackableWith(itemStack: ItemStack): boolean;

    Whether the two could share a slot.

    Parameters
    itemStack
    ItemStack
    Returns
    boolean
    getLore(): string[];

    The lines under the item’s name.

    Returns
    string[]
    getRawLore(): RawMessage[];

    The same as raw messages.

    Returns
    RawMessage[]
    setLore(loreList?: (RawMessage | string)[]): void;

    Sets the lore; nothing takes it away.

    Parameters
    loreListoptional
    (RawMessage | string)[]
    getCanDestroy(): string[];

    Blocks an adventure player may break with it.

    Returns
    string[]
    setCanDestroy(blockIdentifiers?: string[]): void;
    Parameters
    blockIdentifiersoptional
    string[]
    getCanPlaceOn(): string[];

    Blocks an adventure player may place it on.

    Returns
    string[]
    setCanPlaceOn(blockIdentifiers?: string[]): void;
    Parameters
    blockIdentifiersoptional
    string[]
    getTags(): string[];

    The item type’s tags.

    Returns
    string[]
    hasTag(tag: string): boolean;
    Parameters
    tag
    string
    Returns
    boolean
    getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;

    One of this plugin’s dynamic properties on the item.

    Parameters
    identifier
    string
    Returns
    boolean | number | string | Vector3 | undefined
    Types
    getDynamicPropertyIds(): string[];
    Returns
    string[]
    getDynamicPropertyTotalByteCount(): number;
    Returns
    number
    setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
    Parameters
    identifier
    string
    valueoptional
    boolean | number | string | Vector3
    Types
    setDynamicProperties(values: Record<string, boolean | number | string | Vector3 | undefined>): void;
    Parameters
    values
    Record<string, boolean | number | string | Vector3 | undefined>
    Types
    clearDynamicProperties(): void;

    Container.getSlot, EntityEquippableComponent.getEquipmentSlot