"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Action_1 = require("./Action");
const ActionGroup_1 = require("./ActionGroup");
const IScriptGenerationContext_1 = require("./IScriptGenerationContext");
const Location_1 = require("../minecraft/Location");
class BlockSetAction extends Action_1.default {
    get typeId() {
        return "block_set";
    }
    get blockType() {
        return this.getArgumentAsString("blockType");
    }
    get location() {
        return this.getArgumentAsLocation("location");
    }
    getScriptRequirements() {
        return {
            needsLocalOverworld: true,
        };
    }
    getCommandRequirements() {
        return {};
    }
    addCommandLines(lines, indent, options) {
        if (!this.blockType) {
            return;
        }
        let loc = this.location;
        if (!loc) {
            loc = new Location_1.default(0, 0, 0);
        }
        ActionGroup_1.default.addLine(lines, indent, "setblock " + this.blockType + " " + loc.x + " " + loc.y + " " + loc.z);
    }
    addScriptLines(lines, options, context, placement) {
        if (!this.blockType) {
            return;
        }
        if (placement === IScriptGenerationContext_1.ScriptGenerationPlacement.inSequence) {
            let loc = this.location;
            if (!loc) {
                loc = new Location_1.default(0, 0, 0);
            }
            ActionGroup_1.default.addLine(lines, context.indent, "overworld.setlockType({ x: " + loc.x + ", y: " + loc.y + ", z: " + loc.z + '}, "' + this.blockType + '",);');
        }
    }
    validate() {
        this.validateArgumentIsType("location", "Location");
        return true;
    }
}
exports.default = BlockSetAction;

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