mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2025-02-23 20:51:30 +03:00
Download custom resources if url is provided. Mainly made for Fabric
This commit is contained in:
parent
c0cf0aee01
commit
efac3cfe53
4 changed files with 13 additions and 5 deletions
|
@ -246,14 +246,20 @@ module.exports.getClasses = function (options, version) {
|
|||
|
||||
if(options.version.custom) {
|
||||
const customJarJson = require(path.join(options.root, 'versions', options.version.custom, `${options.version.custom}.json`));
|
||||
customJarJson.libraries.map(library => {
|
||||
await Promise.all(customJarJson.libraries.map(async library => {
|
||||
const lib = library.name.split(':');
|
||||
|
||||
const jarPath = path.join(options.root, 'libraries', `${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}`);
|
||||
const name = `${lib[1]}-${lib[2]}.jar`;
|
||||
|
||||
if(!fs.existsSync(path.join(jarPath, name))) {
|
||||
if(library.url) {
|
||||
const url = `${library.url}${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}/${lib[1]}-${lib[2]}.jar`;
|
||||
await downloadAsync(url, jarPath, name);
|
||||
}
|
||||
}
|
||||
libs.push(`${jarPath}/${name}`);
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
await Promise.all(version.libraries.map(async (_lib) => {
|
||||
|
|
|
@ -65,8 +65,9 @@ module.exports = async function (options) {
|
|||
classPaths.push(`${options.forge.path || options.forge}${separator}${forge.paths.join(separator)}${separator}${classes.join(separator)};${mcPath}`);
|
||||
classPaths.push(forge.forge.mainClass)
|
||||
} else {
|
||||
const file = custom || versionFile;
|
||||
classPaths.push(`${mcPath}${separator}${classes.join(separator)}`);
|
||||
classPaths.push(versionFile.mainClass || custom.mainClass);
|
||||
classPaths.push(file.mainClass);
|
||||
}
|
||||
classPaths = await handler.cleanUp(classPaths);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue