Script API - v1.26.10.23
    Preparing search index...
    import { world, EquipmentSlot } from "@minecraft/server";

    const player = world.getPlayers()[0];
    const equippable = player.getComponent("equippable");
    const slot = equippable.getEquipmentSlot(EquipmentSlot.Mainhand);
    import { world } from "@minecraft/server";

    const player = world.getPlayers()[0];
    const inventory = player.getComponent("inventory");
    const slot = inventory.container.getSlot(player.selectedSlotIndex);
    Index

    Constructors

    Properties

    amount: number

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    isStackable: boolean

    This property can throw errors.

    InvalidContainerSlotError

    This property can't be read in early-execution mode.

    isValid: boolean
    keepOnDeath: boolean

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    lockMode: ItemLockMode

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    maxAmount: number

    This property can throw errors.

    InvalidContainerSlotError

    This property can't be read in early-execution mode.

    nameTag?: string

    This property can't be edited in read-only mode.

    This property can't be read in early-execution mode.

    type: ItemType

    This property can throw errors.

    minecraftcommon.EngineError

    InvalidContainerSlotError

    This property can't be read in early-execution mode.

    typeId: string

    This property can throw errors.

    InvalidContainerSlotError

    This property can't be read in early-execution mode.

    Methods

    • Parameters

      • OptionalblockIdentifiers: string[]

      Returns void

      This function can't be called in read-only mode.

      This function can throw errors.

      Error

      InvalidContainerSlotError

      This function can't be called in early-execution mode.

    • Parameters

      • OptionalblockIdentifiers: string[]

      Returns void

      This function can't be called in read-only mode.

      This function can throw errors.

      Error

      InvalidContainerSlotError

      This function can't be called in early-execution mode.