import { EntityEquippableComponent, EquipmentSlot, ItemStack, world } from "@minecraft/server"

/**
 * 
 * @param {EntityEquippableComponent} equippable 
 * @param {EquipmentSlot} slot 
 * @returns {ItemStack}
 */
export function getEquipmentSlot(equippable, slot) {
    try {
        equippable.getEquipmentSlot(slot).typeId // check if the slot is empty, if it is then return undefined
        return equippable.getEquipmentSlot(slot)
    } catch {
        return undefined
    }
}