import { ItemEnchantableComponent } from "@minecraft/server";
export default class Item_Enchantment_Manager {
    static add(item, enchantment) {
        const component = this.component(item);
        if (component == undefined)
            return false;
        if (component.canAddEnchantment(enchantment) == false)
            return false;
        component.addEnchantment(enchantment);
        return true;
    }
    static get(item) {
        const enchantments = new Array();
        const component = this.component(item);
        if (component == undefined)
            return enchantments;
        return component.getEnchantments();
    }
    static component(item) {
        return item.getComponent(ItemEnchantableComponent.componentId);
    }
}
