Compare commits

...

4 Commits

Author SHA1 Message Date
Kamesuta
cdb1583915
Merge 6f9a5c65cc into 7e95771957 2023-11-12 16:24:26 +01:00
Kamesuta
6f9a5c65cc Fix ForgeInstallerCLI path for mac. 2023-10-23 03:22:22 +09:00
Kamesuta
020eeefcae Fix ForgeInstallerCLI path for cross-platform. 2023-10-14 13:29:15 +09:00
Kamesuta
35c5b24bb6 Execute Forge Installer locally 2023-10-01 19:20:08 +09:00
3 changed files with 35 additions and 0 deletions

View File

@ -836,6 +836,13 @@ class ProcessBuilder {
libs = {...libs, ...res}
}
}
} else if(type === Type.Forge){
// Forge installer generated libraries
const forgeLibs = []
for (const library of this.forgeData.libraries) {
forgeLibs.push(path.join(ConfigManager.getCommonDirectory(), 'libraries', library.downloads.artifact.path))
}
libs = {...libs, ...forgeLibs}
}
}

View File

@ -3,6 +3,7 @@
*/
// Requirements
const { URL } = require('url')
const { join } = require('path')
const {
MojangRestAPI,
getServerStatus
@ -548,6 +549,33 @@ async function dlAsync(login = true) {
serv.rawServer.id
)
// Install Forge
let wrapperPath
if(isDev) {
wrapperPath = join(process.cwd(), 'libraries', 'java', 'ForgeInstallerCLI.jar')
} else {
const exePath = remote.app.getPath('exe')
if(process.platform === 'darwin'){
wrapperPath = join(exePath, '..', '..', 'Resources', 'libraries', 'java', 'ForgeInstallerCLI.jar')
} else {
wrapperPath = join(exePath, '..', 'resources', 'libraries', 'java', 'ForgeInstallerCLI.jar')
}
}
// Launch Forge Installer
loggerLaunchSuite.info('Installing Forge.')
setLaunchDetails('Installing Forge..')
setLaunchPercentage(0)
const jExe = ConfigManager.getJavaExecutable(ConfigManager.getSelectedServer())
await distributionIndexProcessor.installForge(jExe, wrapperPath, percent => {
setDownloadPercentage(percent)
})
setDownloadPercentage(100)
// Remove download bar.
remote.getCurrentWindow().setProgressBar(-1)
// After Forge installed, we can get the Forge version data.
const forgeData = await distributionIndexProcessor.loadForgeVersionJson(serv)
const versionData = await mojangIndexProcessor.getVersionJson()

Binary file not shown.