import { EntityScaleComponent } from "@minecraft/server";
import Buffer from "../../_Utilities/Buffer";
export default class Entity_Scale_Manager {
    static set(entity, amount) {
        const component = this.component(entity);
        if (component == undefined)
            return undefined;
        component.value = amount;
    }
    static get(entity) {
        const component = this.component(entity);
        if (component == undefined)
            return undefined;
        return component.value;
    }
    static increase(entity, amount) {
        let value = this.get(entity);
        if (value == undefined)
            return false;
        value = value + amount;
        return this.set(entity, value);
    }
    static decrease(entity, amount) {
        let value = this.get(entity);
        if (value == undefined)
            return false;
        value = value - amount;
        return this.set(entity, value);
    }
    static component(entity) {
        let component = Buffer.get_Data(EntityScaleComponent.componentId, entity.id);
        if (component != undefined)
            return component;
        component = entity.getComponent(EntityScaleComponent.componentId);
        Buffer.set_Data(EntityScaleComponent.componentId, entity.id, component);
        return component;
    }
}
