"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 ItemSpawnAction extends Action_1.default {
    get typeId() {
        return "item_spawn";
    }
    get itemType() {
        return this.getArgumentAsString("itemType");
    }
    get location() {
        return this.getArgumentAsLocation("location");
    }
    getScriptRequirements() {
        return {
            needsLocalOverworld: true,
        };
    }
    getCommandRequirements() {
        return {};
    }
    addCommandLines(lines, indent, options) {
        if (!this.itemType) {
            return;
        }
        let loc = this.location;
        if (!loc) {
            loc = new Location_1.default(0, 0, 0);
        }
        ActionGroup_1.default.addLine(lines, indent, "particle " + this.itemType + " " + loc.x + " " + loc.y + " " + loc.z);
    }
    addScriptLines(lines, options, context, placement) {
        if (!this.itemType) {
            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.spawnItem("' + this.itemType + '", { x: ' + loc.x + ", y: " + loc.y + ", z: " + loc.z + "});");
        }
    }
    validate() {
        return true;
    }
}
exports.default = ItemSpawnAction;

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