import { ItemDurabilityComponent } from "@minecraft/server";
export default class Item_Durability_Manager {
    static add(item, amount) {
        const component = this.component(item);
        if (component == undefined)
            return false;
        component.damage = component.damage + amount;
        return true;
    }
    static set(item, amount) {
        const component = this.component(item);
        if (component == undefined)
            return false;
        component.damage = amount;
        return true;
    }
    static get(item) {
        const component = this.component(item);
        if (component == undefined)
            return undefined;
        return component.maxDurability - component.damage;
    }
    static get_Max(item) {
        const component = this.component(item);
        if (component == undefined)
            return undefined;
        return component.maxDurability;
    }
    static component(item) {
        return item.getComponent(ItemDurabilityComponent.componentId);
    }
}
