"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");
const Log_1 = require("../core/Log");
class EntitySpawnAction extends Action_1.default {
    get typeTitle() {
        return "Spawn Entity";
    }
    get typeId() {
        return "entity_spawn";
    }
    get title() {
        if (!this.entityType) {
            return this.typeTitle;
        }
        return this.typeTitle + " " + this.entityType;
    }
    get entityType() {
        return this.getArgumentAsString("entityType");
    }
    get location() {
        return this.getArgumentAsLocation("location");
    }
    getScriptRequirements() {
        return {
            needsLocalOverworld: true,
        };
    }
    getCommandRequirements() {
        return {};
    }
    addCommandLines(lines, indent, options) {
        if (!this.entityType) {
            return;
        }
        let loc = this.location;
        if (!loc) {
            loc = new Location_1.default(0, 0, 0);
        }
        ActionGroup_1.default.addLine(lines, indent, "summon " + this.entityType + " " + loc.x + " " + loc.y + " " + loc.z);
    }
    addScriptLines(lines, options, context, placement) {
        if (!this.entityType) {
            return;
        }
        if (placement === IScriptGenerationContext_1.ScriptGenerationPlacement.inSequence) {
            let loc = this.location;
            if (!loc) {
                Log_1.default.debugAlert("Action does not have a defined location.");
            }
            else {
                if (options.useGameTestApis) {
                    ActionGroup_1.default.addLine(lines, context.indent, 'test.spawnEntity("' + this.entityType + '", { x: ' + loc.x + ", y: " + loc.y + ", z: " + loc.z + "});");
                }
                else {
                    ActionGroup_1.default.addLine(lines, context.indent, 'overworld.spawnEntity("' + this.entityType + '", { x: ' + loc.x + ", y: " + loc.y + ", z: " + loc.z + "});");
                }
            }
        }
    }
    validate() {
        this.validateArgumentIsType("location", "Location");
        this.validateArgumentIsEntityType("entityType");
        return true;
    }
    getCommand() {
        return "";
    }
    getJavaScript() {
        return "";
    }
}
exports.default = EntitySpawnAction;

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