Class EntityEquippableComponent

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

Hierarchy

Constructors

Properties

typeId: string

Remarks

Identifier of the component.

componentId: "minecraft:equippable" = 'minecraft:equippable'

Methods

  • Parameters

    • equipmentSlot: EquipmentSlot

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

    Returns undefined | ItemStack

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

    Remarks

    Gets the equipped item for the given EquipmentSlot.

    Throws

    This function can throw errors.

  • Returns boolean

    Whether the component is valid.

    Remarks

    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.

  • Parameters

    • equipmentSlot: EquipmentSlot

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

    • Optional itemStack: ItemStack

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

    Returns boolean

    Remarks

    Replaces the item in the given EquipmentSlot.

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

    Throws

    This function can throw errors.