Script API - v1.20.10
    Preparing search index...

    Class EntityEquipmentInventoryComponentBeta

    Provides access to a mob's equipment slots. This component exists for all mob entities.

    const getEntityEquipmentInventoryComponent = entity.getComponent(
    "equipment_inventory"
    );
    getEntityEquipmentInventoryComponent.getEquipment(EquipmentSlot.MainHand);
    const equipmentSlot = EquipmentSlot.Head;
    getEntityEquipmentInventoryComponent.getEquipmentSlot(equipmentSlot);
    getEntityEquipmentInventoryComponent.setEquipment(EquipmentSlot.OffHand); // Assuming undefined (empty slot) as an example

    Hierarchy (View Summary)

    Index

    Properties

    entity: Entity

    The entity that owns this component.

    typeId: string

    Identifier of the component.

    componentId: "minecraft:equipment_inventory" = 'minecraft:equipment_inventory'

    Methods

    • Beta

      Parameters

      • equipmentSlot: EquipmentSlot

        The equipment slot. e.g. "head", "chest", "offhand"

      Returns ItemStack

      Returns the item equipped to the given EquipmentSlot. If empty, returns undefined.

      Gets the equipped item for the given EquipmentSlot.

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

      This function can throw errors.

    • Beta

      Parameters

      • equipmentSlot: EquipmentSlot

        The equipment slot. e.g. "head", "chest", "offhand".

      Returns ContainerSlot

      Returns the ContainerSlot corresponding to the given EquipmentSlot.

      Gets the ContainerSlot corresponding to the given EquipmentSlot.

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

      This function can throw errors.

    • Beta

      Returns boolean

      Whether the component is valid.

      Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.

    • Beta

      Parameters

      • equipmentSlot: EquipmentSlot

        The equipment slot. e.g. "head", "chest", "offhand".

      • OptionalitemStack: ItemStack

        The item to equip. If undefined, clears the slot.

      Returns void

      Replaces the item in the given EquipmentSlot.

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

      This function can throw errors.