onelnchr-mc-loaders
Version:
Provides metadata for minecraft modloaders
38 lines • 1.29 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.url = exports.id = void 0;
exports.getVersionManifest = getVersionManifest;
exports.getMCLCLaunchConfig = getMCLCLaunchConfig;
exports.listSupportedGameVersions = listSupportedGameVersions;
const axios_1 = __importDefault(require("axios"));
exports.id = 'vanilla';
exports.url = 'https://www.minecraft.net/';
async function getVersionManifest() {
return (await axios_1.default.get('https://piston-meta.mojang.com/mc/game/version_manifest_v2.json')).data;
}
/**
* Downloads the latest version json and returns a partial MCLC config
*/
async function getMCLCLaunchConfig(config) {
return {
root: config.rootPath,
version: {
number: config.gameVersion,
type: 'release',
},
};
}
/**
* Returns all game versions a loader supports
*/
async function listSupportedGameVersions() {
const versionManifest = await getVersionManifest();
return versionManifest.versions.map((version) => ({
version: version.id,
stable: version.type === 'release',
}));
}
//# sourceMappingURL=vanilla.js.map