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

// Gives the player Elytra
import { EquipmentSlot, ItemStack, Player, EntityComponentTypes } from '@minecraft/server';
import { MinecraftItemTypes } from '@minecraft/vanilla-data';

function giveEquipment(player: Player) {
const equipmentCompPlayer = player.getComponent(EntityComponentTypes.Equippable);
if (equipmentCompPlayer) {
equipmentCompPlayer.setEquipment(EquipmentSlot.Chest, new ItemStack(MinecraftItemTypes.Elytra));
}
}

Hierarchy (View Summary)

Constructors

Properties

entity: Entity

The entity that owns this component. The entity will be undefined if it has been removed.

typeId: string

Identifier of the component.

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

Methods