UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

40 lines (38 loc) 1.71 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); const ProjectExporter_1 = require("../app/ProjectExporter"); const fs = require("fs"); const open = require("open"); class LocalTools { static async exportWorld(carto, project, path) { carto.notifyStatusUpdate("Starting export"); const name = project.name + " World"; const fileName = project.name + ".mcworld"; carto.notifyStatusUpdate("Packing " + fileName); const newBytes = await ProjectExporter_1.default.generateFlatBetaApisWorldWithPacksZipBytes(carto, project, name); carto.notifyStatusUpdate("Now saving " + fileName); if (newBytes !== undefined) { fs.writeFileSync(path, newBytes); } } static async convertFromJavaWorld(carto, javaWorldFile) { } static async launchWorld(carto, worldFolderName) { const commandLine = "minecraft://mode/?load=" + worldFolderName; console.log("Running " + commandLine); await open(commandLine); } static async ensureFlatPackRefWorldTo(carto, project, rootFolder, name) { const childFolder = rootFolder.ensureFolder(name); await childFolder.ensureExists(); await ProjectExporter_1.default.syncFlatPackRefWorldTo(carto, project, childFolder, name); await childFolder.saveAll(); } static async deploy(carto, project, storage, rootFolder, name) { await ProjectExporter_1.default.deployProject(carto, project, rootFolder); await rootFolder.saveAll(); } } exports.default = LocalTools; //# sourceMappingURL=../maps/local/LocalTools.js.map