mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-25 05:26:22 +03:00
3.16.0
Supports new 1.12.2 forge through installer. Simplified Forge related functions
This commit is contained in:
parent
f947379727
commit
6efbc5e2c5
4 changed files with 154 additions and 174 deletions
|
@ -2,7 +2,7 @@
|
||||||
##### This project is complete for now.
|
##### This project is complete for now.
|
||||||
[![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core)
|
[![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core)
|
||||||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
||||||
![version](https://img.shields.io/badge/stable_version-3.14.6-blue)
|
![version](https://img.shields.io/badge/stable_version-3.16.0-blue)
|
||||||
![badge](https://img.shields.io/badge/ncurses-not_supported-purple)
|
![badge](https://img.shields.io/badge/ncurses-not_supported-purple)
|
||||||
|
|
||||||
MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself.
|
MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself.
|
||||||
|
|
|
@ -245,7 +245,7 @@ class Handler {
|
||||||
const natives = async () => {
|
const natives = async () => {
|
||||||
const natives = []
|
const natives = []
|
||||||
await Promise.all(this.version.libraries.map(async (lib) => {
|
await Promise.all(this.version.libraries.map(async (lib) => {
|
||||||
if (!lib.downloads.classifiers) return
|
if (!lib.downloads || !lib.downloads.classifiers) return
|
||||||
if (this.parseRule(lib)) return
|
if (this.parseRule(lib)) return
|
||||||
|
|
||||||
const native = this.getOS() === 'osx'
|
const native = this.getOS() === 'osx'
|
||||||
|
@ -296,165 +296,153 @@ class Handler {
|
||||||
return nativeDirectory
|
return nativeDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not bothering to rewrite this.
|
fwAddArgs () {
|
||||||
async getForgeDependenciesLegacy () {
|
const forgeWrapperAgrs = [
|
||||||
if (!fs.existsSync(path.join(this.options.root, 'forge'))) {
|
`-Dforgewrapper.librariesDir=${path.resolve(this.options.overrides.libraryRoot || path.join(this.options.root, 'libraries'))}`,
|
||||||
fs.mkdirSync(path.join(this.options.root, 'forge'), { recursive: true })
|
`-Dforgewrapper.installer=${this.options.forge}`,
|
||||||
}
|
`-Dforgewrapper.minecraft=${this.options.mcPath}`
|
||||||
|
]
|
||||||
const zipFile = new Zip(this.options.forge)
|
this.options.customArgs
|
||||||
|
? this.options.customArgs = this.options.customArgs.concat(forgeWrapperAgrs)
|
||||||
if (zipFile.getEntry('install_profile.json')) {
|
: this.options.customArgs = forgeWrapperAgrs
|
||||||
this.client.emit('debug', '[MCLC]: Detected Forge installer, will treat as custom with ForgeWrapper')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await zipFile.extractEntryTo('version.json', path.join(this.options.root, 'forge', `${this.version.id}`), false, true)
|
|
||||||
} catch (e) {
|
|
||||||
this.client.emit('debug', `[MCLC]: Unable to extract version.json from the forge jar due to ${e}`)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const forge = JSON.parse(fs.readFileSync(path.join(this.options.root, 'forge', `${this.version.id}`, 'version.json'), { encoding: 'utf8' }))
|
|
||||||
const paths = []
|
|
||||||
|
|
||||||
this.client.emit('progress', {
|
|
||||||
type: 'forge',
|
|
||||||
task: 0,
|
|
||||||
total: forge.libraries.length
|
|
||||||
})
|
|
||||||
|
|
||||||
const libraryDirectory = path.resolve(this.options.overrides.libraryRoot || path.join(this.options.root, 'libraries'))
|
|
||||||
|
|
||||||
await Promise.all(forge.libraries.map(async library => {
|
|
||||||
const lib = library.name.split(':')
|
|
||||||
|
|
||||||
if (lib[0] === 'net.minecraftforge' && lib[1].includes('forge')) return
|
|
||||||
|
|
||||||
let url = this.options.overrides.url.mavenForge
|
|
||||||
const jarPath = path.join(libraryDirectory, `${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}`)
|
|
||||||
const name = `${lib[1]}-${lib[2]}.jar`
|
|
||||||
|
|
||||||
if (!library.url) {
|
|
||||||
if (library.serverreq || library.clientreq) {
|
|
||||||
url = this.options.overrides.url.defaultRepoForge
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const downloadLink = `${url}${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}/${name}`
|
|
||||||
|
|
||||||
if (fs.existsSync(path.join(jarPath, name))) {
|
|
||||||
paths.push(`${jarPath}${path.sep}${name}`)
|
|
||||||
counter++
|
|
||||||
this.client.emit('progress', { type: 'forge', task: counter, total: forge.libraries.length })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!fs.existsSync(jarPath)) fs.mkdirSync(jarPath, { recursive: true })
|
|
||||||
|
|
||||||
const download = await this.downloadAsync(downloadLink, jarPath, name, true, 'forge')
|
|
||||||
if (!download) await this.downloadAsync(`${this.options.overrides.url.fallbackMaven}${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}/${name}`, jarPath, name, true, 'forge')
|
|
||||||
|
|
||||||
paths.push(`${jarPath}${path.sep}${name}`)
|
|
||||||
counter++
|
|
||||||
this.client.emit('progress', {
|
|
||||||
type: 'forge',
|
|
||||||
task: counter,
|
|
||||||
total: forge.libraries.length
|
|
||||||
})
|
|
||||||
}))
|
|
||||||
|
|
||||||
counter = 0
|
|
||||||
this.client.emit('debug', '[MCLC]: Downloaded Forge dependencies')
|
|
||||||
|
|
||||||
return { paths, forge }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getForgedWrapped () {
|
async getForgedWrapped () {
|
||||||
return new Promise(resolve => {
|
let json = null
|
||||||
const forgeWrapperAgrs = [
|
let installerJson = null
|
||||||
`-Dforgewrapper.librariesDir=${path.resolve(this.options.overrides.libraryRoot || path.join(this.options.root, 'libraries'))}`,
|
const versionPath = path.join(this.options.root, 'forge', `${this.version.id}`, 'version.json')
|
||||||
`-Dforgewrapper.installer=${this.options.forge}`,
|
// Since we're building a proper "custom" JSON that will work nativly with MCLC, the version JSON will not
|
||||||
`-Dforgewrapper.minecraft=${this.options.mcPath}`
|
// be re-generated on the next run.
|
||||||
]
|
if (fs.existsSync(versionPath)) {
|
||||||
this.options.customArgs
|
|
||||||
? this.options.customArgs = this.options.customArgs.concat(forgeWrapperAgrs)
|
|
||||||
: this.options.customArgs = forgeWrapperAgrs
|
|
||||||
|
|
||||||
let json = null
|
|
||||||
const versionPath = path.join(this.options.root, 'forge', `${this.version.id}`, 'version.json')
|
|
||||||
// Since we're building a proper "custom" JSON that will work nativly with MCLC, the version JSON will not
|
|
||||||
// be re-generated on the next run.
|
|
||||||
if (fs.existsSync(versionPath)) {
|
|
||||||
try {
|
|
||||||
json = JSON.parse(fs.readFileSync(versionPath))
|
|
||||||
if (!json.forgeWrapperVersion || !(json.forgeWrapperVersion === this.fw.version)) {
|
|
||||||
this.client.emit('debug', '[MCLC]: Old ForgeWrapper has generated this version JSON, re-generating')
|
|
||||||
} else {
|
|
||||||
return resolve(json)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
this.client.emit('debug', '[MCLC]: Failed to parse Forge version JSON, re-generating')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.client.emit('debug', '[MCLC]: Generating a proper version json, this might take a bit')
|
|
||||||
const zipFile = new Zip(this.options.forge)
|
|
||||||
json = zipFile.readAsText('version.json')
|
|
||||||
let installerJson = zipFile.readAsText('install_profile.json')
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
json = JSON.parse(json)
|
json = JSON.parse(fs.readFileSync(versionPath))
|
||||||
installerJson = JSON.parse(installerJson)
|
if (!json.forgeWrapperVersion || !(json.forgeWrapperVersion === this.options.fw.version)) {
|
||||||
|
this.client.emit('debug', '[MCLC]: Old ForgeWrapper has generated this version JSON, re-generating')
|
||||||
|
} else {
|
||||||
|
this.fwAddArgs()
|
||||||
|
// Make MCLC treat modern forge as a custom version json rather then legacy forge.
|
||||||
|
this.options.forge = null
|
||||||
|
return json
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.client.emit('debug', '[MCLC]: Failed to load json files for ForgeWrapper, using Vanilla instead')
|
console.warn(e)
|
||||||
return resolve(null)
|
this.client.emit('debug', '[MCLC]: Failed to parse Forge version JSON, re-generating')
|
||||||
}
|
}
|
||||||
// So we know when to re-generate the file when there's a new ForgeWrapper version.
|
}
|
||||||
json.forgeWrapperVersion = this.options.fw.version
|
|
||||||
// Adding the installer libraries as mavenFiles so MCLC downloads them but doesn't add them to the class paths.
|
this.client.emit('debug', '[MCLC]: Generating a proper version json, this might take a bit')
|
||||||
|
const zipFile = new Zip(this.options.forge)
|
||||||
|
json = zipFile.readAsText('version.json')
|
||||||
|
if (zipFile.getEntry('install_profile.json')) installerJson = zipFile.readAsText('install_profile.json')
|
||||||
|
|
||||||
|
try {
|
||||||
|
json = JSON.parse(json)
|
||||||
|
if (installerJson) installerJson = JSON.parse(installerJson)
|
||||||
|
} catch (e) {
|
||||||
|
this.client.emit('debug', '[MCLC]: Failed to load json files for ForgeWrapper, using Vanilla instead')
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
// Adding the installer libraries as mavenFiles so MCLC downloads them but doesn't add them to the class paths.
|
||||||
|
if (installerJson) {
|
||||||
json.mavenFiles
|
json.mavenFiles
|
||||||
? json.mavenFiles = json.mavenFiles.concat(installerJson.libraries)
|
? json.mavenFiles = json.mavenFiles.concat(installerJson.libraries)
|
||||||
: json.mavenFiles = installerJson.libraries
|
: json.mavenFiles = installerJson.libraries
|
||||||
|
}
|
||||||
|
|
||||||
// Modifying inital forge entry to include launcher so ForgeWrapper can work properly
|
// Holder for the specifc jar ending which depends on the specifc forge version.
|
||||||
json.libraries[0].name = json.libraries[0].name + ':launcher'
|
let jarEnding = 'universal'
|
||||||
json.libraries[0].downloads.artifact.path = json.libraries[0].downloads.artifact.path.replace('.jar', '-launcher.jar')
|
// We need to handle modern forge differently than legacy.
|
||||||
json.libraries[0].downloads.artifact.url = 'https://files.minecraftforge.net/maven/' + json.libraries[0].downloads.artifact.path
|
if (json.inheritsFrom && json.inheritsFrom.split('.')[1] >= 12) {
|
||||||
// Providing a download URL to the universal jar library so it can be downloaded properly.
|
// If forge is modern and above 1.12, we add ForgeWrapper to the libraries so MCLC includes it in the classpaths.
|
||||||
for (const library of json.mavenFiles) {
|
if (json.inheritsFrom !== '1.12.2') {
|
||||||
const lib = library.name.split(':')
|
this.fwAddArgs()
|
||||||
if (lib[0] === 'net.minecraftforge' && lib[1].includes('forge')) {
|
const fwName = `ForgeWrapper-${this.options.fw.version}.jar`
|
||||||
library.downloads.artifact.url = 'https://files.minecraftforge.net/maven/' + library.downloads.artifact.path
|
const fwPathArr = ['io', 'github', 'zekerzhayard', 'ForgeWrapper', this.options.fw.version]
|
||||||
break
|
json.libraries.push({
|
||||||
}
|
name: fwPathArr.join(':'),
|
||||||
}
|
downloads: {
|
||||||
|
artifact: {
|
||||||
|
path: [...fwPathArr, fwName].join('/'),
|
||||||
|
url: `${this.options.fw.baseUrl}${this.options.fw.version}/${fwName}`,
|
||||||
|
sha1: this.options.fw.sh1,
|
||||||
|
size: this.options.fw.size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
json.mainClass = 'io.github.zekerzhayard.forgewrapper.installer.Main'
|
||||||
|
jarEnding = 'launcher'
|
||||||
|
|
||||||
const fwName = `ForgeWrapper-${this.options.fw.version}.jar`
|
// Providing a download URL to the universal jar mavenFile so it can be downloaded properly.
|
||||||
const fwPathArr = ['io', 'github', 'zekerzhayard', 'ForgeWrapper', this.options.fw.version]
|
for (const library of json.mavenFiles) {
|
||||||
// Adding ForgeWrapper to the libraries list so MCLC includes it in the classpaths.
|
const lib = library.name.split(':')
|
||||||
json.libraries.push({
|
if (lib[0] === 'net.minecraftforge' && lib[1].includes('forge')) {
|
||||||
name: fwPathArr.join(':'),
|
library.downloads.artifact.url = 'https://files.minecraftforge.net/maven/' + library.downloads.artifact.path
|
||||||
downloads: {
|
break
|
||||||
artifact: {
|
}
|
||||||
path: [...fwPathArr, fwName].join('/'),
|
}
|
||||||
url: `${this.options.fw.baseUrl}${this.options.fw.version}/${fwName}`,
|
} else {
|
||||||
sha1: this.options.fw.sh1,
|
// Remove the forge dependent since we're going to overwrite the first entry anyways.
|
||||||
size: this.options.fw.size
|
for (const library in json.mavenFiles) {
|
||||||
|
const lib = json.mavenFiles[library].name.split(':')
|
||||||
|
if (lib[0] === 'net.minecraftforge' && lib[1].includes('forge')) {
|
||||||
|
delete json.mavenFiles[library]
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
json.mainClass = 'io.github.zekerzhayard.forgewrapper.installer.Main'
|
|
||||||
|
|
||||||
if (!fs.existsSync(path.join(this.options.root, 'forge', this.version.id))) {
|
|
||||||
fs.mkdirSync(path.join(this.options.root, 'forge', this.version.id), { recursive: true })
|
|
||||||
}
|
}
|
||||||
fs.writeFileSync(versionPath, JSON.stringify(json, null, 4))
|
} else {
|
||||||
|
// Modifying legacy library format to play nice with MCLC's downloadToDirectory function.
|
||||||
|
await Promise.all(json.libraries.map(async library => {
|
||||||
|
const lib = library.name.split(':')
|
||||||
|
if (lib[0] === 'net.minecraftforge' && lib[1].includes('forge')) return
|
||||||
|
|
||||||
return resolve(json)
|
let url = this.options.overrides.url.mavenForge
|
||||||
})
|
const name = `${lib[1]}-${lib[2]}.jar`
|
||||||
|
|
||||||
|
if (!library.url) {
|
||||||
|
if (library.serverreq || library.clientreq) {
|
||||||
|
url = this.options.overrides.url.defaultRepoForge
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
library.url = url
|
||||||
|
const downloadLink = `${url}${lib[0].replace(/\./g, '/')}/${lib[1]}/${lib[2]}/${name}`
|
||||||
|
// Checking if the file still exists on Forge's server, if not, replace it with the fallback.
|
||||||
|
// Not checking for sucess, only if it 404s.
|
||||||
|
this.baseRequest(downloadLink, (error, response, body) => {
|
||||||
|
if (error) {
|
||||||
|
this.client.emit('debug', `[MCLC]: Failed checking request for ${downloadLink}`)
|
||||||
|
} else {
|
||||||
|
if (response.statusCode === 404) library.url = this.options.overrides.url.fallbackMaven
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
// If a downloads property exists, we modify the inital forge entry to include ${jarEnding} so ForgeWrapper can work properly.
|
||||||
|
// If it doesn't, we simply remove it since we're already providing the universal jar.
|
||||||
|
if (json.libraries[0].downloads) {
|
||||||
|
json.libraries[0].name = json.libraries[0].name + `:${jarEnding}`
|
||||||
|
json.libraries[0].downloads.artifact.path = json.libraries[0].downloads.artifact.path.replace('.jar', `-${jarEnding}.jar`)
|
||||||
|
json.libraries[0].downloads.artifact.url = 'https://files.minecraftforge.net/maven/' + json.libraries[0].downloads.artifact.path
|
||||||
|
} else {
|
||||||
|
delete json.libraries[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Removing duplicates and null types
|
||||||
|
json.libraries = this.cleanUp(json.libraries)
|
||||||
|
if (json.mavenFiles) json.mavenFiles = this.cleanUp(json.mavenFiles)
|
||||||
|
|
||||||
|
// Saving file for next run!
|
||||||
|
if (!fs.existsSync(path.join(this.options.root, 'forge', this.version.id))) {
|
||||||
|
fs.mkdirSync(path.join(this.options.root, 'forge', this.version.id), { recursive: true })
|
||||||
|
}
|
||||||
|
fs.writeFileSync(versionPath, JSON.stringify(json, null, 4))
|
||||||
|
|
||||||
|
// Make MCLC treat modern forge as a custom version json rather then legacy forge.
|
||||||
|
this.options.forge = null
|
||||||
|
|
||||||
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
runInstaller (path) {
|
runInstaller (path) {
|
||||||
|
@ -517,7 +505,7 @@ class Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsed = this.version.libraries.map(lib => {
|
const parsed = this.version.libraries.map(lib => {
|
||||||
if (lib.downloads.artifact && !this.parseRule(lib)) return lib
|
if (lib.downloads && lib.downloads.artifact && !this.parseRule(lib)) return lib
|
||||||
})
|
})
|
||||||
|
|
||||||
libs = libs.concat((await this.downloadToDirectory(libraryDirectory, parsed, 'classes')))
|
libs = libs.concat((await this.downloadToDirectory(libraryDirectory, parsed, 'classes')))
|
||||||
|
@ -536,7 +524,7 @@ class Handler {
|
||||||
cleanUp (array) {
|
cleanUp (array) {
|
||||||
const newArray = []
|
const newArray = []
|
||||||
for (const classPath in array) {
|
for (const classPath in array) {
|
||||||
if (newArray.includes(array[classPath])) continue
|
if (newArray.includes(array[classPath]) || array[classPath] === null) continue
|
||||||
newArray.push(array[classPath])
|
newArray.push(array[classPath])
|
||||||
}
|
}
|
||||||
return newArray
|
return newArray
|
||||||
|
|
|
@ -59,7 +59,7 @@ class MCLCore extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.options.installer) {
|
if (this.options.installer) {
|
||||||
// So the forge installer can run without breaking :)
|
// So installers that create a profile in launcher_profiles.json can run without breaking.
|
||||||
const profilePath = path.join(this.options.root, 'launcher_profiles.json')
|
const profilePath = path.join(this.options.root, 'launcher_profiles.json')
|
||||||
if (!fs.existsSync(profilePath)) { fs.writeFileSync(profilePath, JSON.stringify({}, null, 4)) }
|
if (!fs.existsSync(profilePath)) { fs.writeFileSync(profilePath, JSON.stringify({}, null, 4)) }
|
||||||
await this.handler.runInstaller(this.options.installer)
|
await this.handler.runInstaller(this.options.installer)
|
||||||
|
@ -80,17 +80,15 @@ class MCLCore extends EventEmitter {
|
||||||
await this.handler.getJar()
|
await this.handler.getJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
let forge = null
|
let modifyJson = null
|
||||||
let custom = null
|
|
||||||
if (this.options.forge) {
|
if (this.options.forge) {
|
||||||
this.options.forge = path.resolve(this.options.forge)
|
this.options.forge = path.resolve(this.options.forge)
|
||||||
this.emit('debug', '[MCLC]: Detected Forge in options, getting dependencies')
|
this.emit('debug', '[MCLC]: Detected Forge in options, getting dependencies')
|
||||||
forge = await this.handler.getForgeDependenciesLegacy()
|
modifyJson = await this.handler.getForgedWrapped()
|
||||||
if (forge === false) custom = await this.handler.getForgedWrapped()
|
|
||||||
}
|
}
|
||||||
if (this.options.version.custom || custom) {
|
if (this.options.version.custom) {
|
||||||
if (!custom) this.emit('debug', '[MCLC]: Detected custom in options, setting custom version file')
|
this.emit('debug', '[MCLC]: Detected custom in options, setting custom version file')
|
||||||
custom = custom || JSON.parse(fs.readFileSync(path.join(this.options.root, 'versions', this.options.version.custom, `${this.options.version.custom}.json`), { encoding: 'utf8' }))
|
modifyJson = modifyJson || JSON.parse(fs.readFileSync(path.join(this.options.root, 'versions', this.options.version.custom, `${this.options.version.custom}.json`), { encoding: 'utf8' }))
|
||||||
}
|
}
|
||||||
|
|
||||||
const args = []
|
const args = []
|
||||||
|
@ -110,30 +108,24 @@ class MCLCore extends EventEmitter {
|
||||||
|
|
||||||
if (this.options.customArgs) jvm = jvm.concat(this.options.customArgs)
|
if (this.options.customArgs) jvm = jvm.concat(this.options.customArgs)
|
||||||
|
|
||||||
const classes = this.options.overrides.classes || this.handler.cleanUp(await this.handler.getClasses(custom))
|
const classes = this.options.overrides.classes || this.handler.cleanUp(await this.handler.getClasses(modifyJson))
|
||||||
const classPaths = ['-cp']
|
const classPaths = ['-cp']
|
||||||
const separator = this.handler.getOS() === 'windows' ? ';' : ':'
|
const separator = this.handler.getOS() === 'windows' ? ';' : ':'
|
||||||
this.emit('debug', `[MCLC]: Using ${separator} to separate class paths`)
|
this.emit('debug', `[MCLC]: Using ${separator} to separate class paths`)
|
||||||
if (forge) {
|
// Handling launch arguments.
|
||||||
this.emit('debug', '[MCLC]: Setting Forge class paths')
|
const file = modifyJson || versionFile
|
||||||
classPaths.push(`${path.resolve(this.options.forge)}${separator}${forge.paths.join(separator)}${separator}${classes.join(separator)}${separator}${mcPath}`)
|
// So mods like fabric work.
|
||||||
classPaths.push(forge.forge.mainClass)
|
const jar = fs.existsSync(mcPath)
|
||||||
} else {
|
? `${separator}${mcPath}`
|
||||||
const file = custom || versionFile
|
: `${separator}${path.join(directory, `${this.options.version.number}.jar`)}`
|
||||||
// So mods like fabric work.
|
classPaths.push(`${this.options.forge ? this.options.forge + separator : ''}${classes.join(separator)}${jar}`)
|
||||||
const jar = fs.existsSync(mcPath)
|
classPaths.push(file.mainClass)
|
||||||
? `${separator}${mcPath}`
|
|
||||||
: `${separator}${path.join(directory, `${this.options.version.number}.jar`)}`
|
|
||||||
classPaths.push(`${classes.join(separator)}${jar}`)
|
|
||||||
classPaths.push(file.mainClass)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emit('debug', '[MCLC]: Attempting to download assets')
|
this.emit('debug', '[MCLC]: Attempting to download assets')
|
||||||
await this.handler.getAssets()
|
await this.handler.getAssets()
|
||||||
|
|
||||||
// Forge -> Custom -> Vanilla
|
// Forge -> Custom -> Vanilla
|
||||||
const modification = forge ? forge.forge : null || custom ? custom : null
|
const launchOptions = await this.handler.getLaunchOptions(modifyJson)
|
||||||
const launchOptions = await this.handler.getLaunchOptions(modification)
|
|
||||||
|
|
||||||
const launchArguments = args.concat(jvm, classPaths, launchOptions)
|
const launchArguments = args.concat(jvm, classPaths, launchOptions)
|
||||||
this.emit('arguments', launchArguments)
|
this.emit('arguments', launchArguments)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "minecraft-launcher-core",
|
"name": "minecraft-launcher-core",
|
||||||
"version": "3.15.6",
|
"version": "3.16.0",
|
||||||
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
|
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue