What a player or mob wears and holds: armour, the main hand (a player's held slot), the offhand, and a mob's body.
Class in @minecraft/server
Extends EntityComponent
What a player or mob wears and holds: armour, the main hand (a player’s held slot), the offhand, and a mob’s body.
import { EntityEquippableComponent } from '@minecraft/server';Example
Section titled “Example”import { world, type EntityEquippableComponent } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const component: EntityEquippableComponent | undefined = player.getComponent('minecraft:equippable'); if (component) { console.log(player.name, component.typeId); }}import { world } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const component = player.getComponent('minecraft:equippable'); if (component) { console.log(player.name, component.typeId); }}Properties
Section titled “Properties”typeId
Section titled “typeId”read-only
readonly typeId: "minecraft:equippable";entity
Section titled “entity”read-only
readonly entity: Entity;Types
isValid
Section titled “isValid”read-only
readonly isValid: boolean;Methods
Section titled “Methods”getEquipment
Section titled “getEquipment”getEquipment(equipmentSlot: EquipmentSlot): ItemStack | undefined;The item in a slot, or undefined if it’s empty.
Parameters
equipmentSlotEquipmentSlot
Returns
ItemStack | undefinedgetEquipmentSlot
Section titled “getEquipmentSlot”getEquipmentSlot(equipmentSlot: EquipmentSlot): ContainerSlot;A live handle on a slot, for reading or changing the item in it as it changes, rather than
a one-off copy. The same slots getEquipment and setEquipment reach.
Parameters
equipmentSlotEquipmentSlot
Returns
ContainerSlotsetEquipment
Section titled “setEquipment”setEquipment(equipmentSlot: EquipmentSlot, itemStack?: ItemStack): boolean;Puts an item in a slot, or empties it with no item. Those who see a mob are shown it at once, and the mob keeps it when saved (its body slot excepted).
Parameters
equipmentSlotEquipmentSlotitemStackoptionalItemStack
Returns
booleanTrue: the change is sent.Used by
Section titled “Used by”EntityComponentTypeMap.minecraft:equippable, EntityComponentTypeMap.equippable