import { ItemComponentTypes, ItemDurabilityComponent, ItemEnchantableComponent, ItemStack } from "@minecraft/server"

export class ItemComponents {
    /**
     * 
     * @param {ItemStack} itemStack 
     * @returns {ItemDurabilityComponent}
     */
    static getDurability(itemStack) {
        return itemStack.getComponent(ItemComponentTypes.Durability)
    }

    /**
     * 
     * @param {ItemStack} itemStack 
     * @returns {ItemEnchantableComponent}
     */
    static getEnchantable(itemStack) {
        return itemStack.getComponent(ItemComponentTypes.Enchantable)
    }
}