UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

72 lines (71 loc) 2.28 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Action_1 = __importDefault(require("./Action")); const ActionGroup_1 = __importDefault(require("./ActionGroup")); const Location_1 = __importDefault(require("../minecraft/Location")); class TestSimulatedPlayerMoveAction extends Action_1.default { get typeTitle() { return "Move Simulated Player"; } get typeId() { return "test_simulated_player_move"; } get shortSubjectId() { return "simplayer"; } get title() { if (!this.location) { return this.typeTitle; } return this.typeTitle + " " + this.location.toSummary(); } get location() { return this.getArgumentAsLocation("location"); } set location(location) { if (!location) { this.data["location"] = undefined; } else { this.data["location"] = [location.x, location.y, location.z]; } } validate() { this.validateArgumentIsType("location", "Location"); return true; } getScriptRequirements(options) { return { needsTest: true, }; } getCommandRequirements(options) { return {}; } addCommandLines(lines, indent) { let location = this.location; if (!location) { location = new Location_1.default(0, 0, 0); } location = this.absolutizeLocation(location); ActionGroup_1.default.addLine(lines, indent, "tp @p[tag=" + this.getCommandWith() + "]" + location.x + " " + location.y + " " + location.z); } addScriptLines(lines, options, context, placement) { let location = this.location; if (!location) { location = new Location_1.default(0, 0, 0); } ActionGroup_1.default.addLine(lines, context.indent, this.getScriptWith() + ".moveToLocation(new Location(" + location.x + ", " + location.y + ", " + location.z + "));"); } } exports.default = TestSimulatedPlayerMoveAction;