mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-25 13:36:21 +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
|
@ -60,7 +60,8 @@ launcher.authenticator.getAuth("email", "password").then(auth => {
|
||||||
| `options.proxy.password` | String | Password for the proxy. | False |
|
| `options.proxy.password` | String | Password for the proxy. | False |
|
||||||
|
|
||||||
##### Note
|
##### Note
|
||||||
If you are loading up a client outside of vanilla Minecraft and Forge (Optifine for an example), you'll need to download the needed files yourself.
|
If you are loading up a client outside of vanilla Minecraft or Forge (Optifine and for an example), you'll need to download the needed files yourself
|
||||||
|
if you don't provide downloads url downloads like Forge and Fabric. Still need to provide the version jar.
|
||||||
|
|
||||||
#### launcher.authenticator Functions
|
#### launcher.authenticator Functions
|
||||||
|
|
||||||
|
|
|
@ -246,14 +246,20 @@ module.exports.getClasses = function (options, version) {
|
||||||
|
|
||||||
if(options.version.custom) {
|
if(options.version.custom) {
|
||||||
const customJarJson = require(path.join(options.root, 'versions', options.version.custom, `${options.version.custom}.json`));
|
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 lib = library.name.split(':');
|
||||||
|
|
||||||
const jarPath = path.join(options.root, 'libraries', `${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}`);
|
const jarPath = path.join(options.root, 'libraries', `${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}`);
|
||||||
const name = `${lib[1]}-${lib[2]}.jar`;
|
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}`);
|
libs.push(`${jarPath}/${name}`);
|
||||||
})
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(version.libraries.map(async (_lib) => {
|
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(`${options.forge.path || options.forge}${separator}${forge.paths.join(separator)}${separator}${classes.join(separator)};${mcPath}`);
|
||||||
classPaths.push(forge.forge.mainClass)
|
classPaths.push(forge.forge.mainClass)
|
||||||
} else {
|
} else {
|
||||||
|
const file = custom || versionFile;
|
||||||
classPaths.push(`${mcPath}${separator}${classes.join(separator)}`);
|
classPaths.push(`${mcPath}${separator}${classes.join(separator)}`);
|
||||||
classPaths.push(versionFile.mainClass || custom.mainClass);
|
classPaths.push(file.mainClass);
|
||||||
}
|
}
|
||||||
classPaths = await handler.cleanUp(classPaths);
|
classPaths = await handler.cleanUp(classPaths);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "minecraft-launcher-core",
|
"name": "minecraft-launcher-core",
|
||||||
"version": "2.7.0",
|
"version": "2.8.0",
|
||||||
"description": "Module that downloads Minecraft assets and runs Minecraft. Also Supports Forge",
|
"description": "Module that downloads Minecraft assets and runs Minecraft. Also Supports Forge",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue