"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const IActionSetData_1 = require("./IActionSetData");
const ActionGroup_1 = require("./ActionGroup");
const Location_1 = require("../minecraft/Location");
const BlockLocation_1 = require("../minecraft/BlockLocation");
class ActionSet extends ActionGroup_1.default {
    actionSetData;
    _test;
    _locationRoot;
    get targetType() {
        if (!this.actionSetData || !this.actionSetData.targetType) {
            return IActionSetData_1.ActionSetTarget.general;
        }
        return this.actionSetData.targetType;
    }
    set targetType(newTargetType) {
        this.actionSetData.targetType = newTargetType;
    }
    get locationRoot() {
        return this._locationRoot;
    }
    set locationRoot(newRoot) {
        this._locationRoot = newRoot;
    }
    absolutizeLocation(location) {
        if (!this.locationRoot) {
            return location;
        }
        return new Location_1.default(this.locationRoot.x + location.x, this.locationRoot.y + location.y, this.locationRoot.z + location.z);
    }
    absolutizeBlockLocation(location) {
        if (!this.locationRoot) {
            return location;
        }
        return new BlockLocation_1.default(Math.round(this.locationRoot.x + location.x), Math.round(this.locationRoot.y + location.y), Math.round(this.locationRoot.z + location.z));
    }
    relativizeLocation(location) {
        if (!this.locationRoot) {
            return location;
        }
        return new Location_1.default(location.x - this.locationRoot.x, location.y - this.locationRoot.y, location.z - this.locationRoot.z);
    }
    relativizeBlockLocation(location) {
        if (!this.locationRoot) {
            return location;
        }
        return new BlockLocation_1.default(Math.round(location.x - this.locationRoot.x), Math.round(location.y - this.locationRoot.y), Math.round(location.z - this.locationRoot.z));
    }
    get test() {
        return this._test;
    }
    get name() {
        return this.actionSetData.name;
    }
    set name(newValue) {
        this.actionSetData.name = newValue;
    }
    constructor(data) {
        super(data, undefined, true);
        this.actionSetData = data;
        this._actionSet = this;
        this._hydrate();
    }
}
exports.default = ActionSet;

//# sourceMappingURL=../maps/actions/ActionSet.js.map
