diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index e02a90c8..0e955621 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -12,14 +12,23 @@ const ConfigManager = require('./configmanager') const logger = LoggerUtil.getLogger('ProcessBuilder') + +/** + * Only forge and fabric are top level mod loaders. + * + * Forge 1.13+ launch logic is similar to fabrics, for now using usingFabricLoader flag to + * change minor details when needed. + * + * Rewrite of this module may be needed in the future. + */ class ProcessBuilder { - constructor(distroServer, versionData, forgeData, authUser, launcherVersion){ + constructor(distroServer, vanillaManifest, modManifest, authUser, launcherVersion){ this.gameDir = path.join(ConfigManager.getInstanceDirectory(), distroServer.rawServer.id) this.commonDir = ConfigManager.getCommonDirectory() this.server = distroServer - this.versionData = versionData - this.forgeData = forgeData + this.vanillaManifest = vanillaManifest + this.modManifest = modManifest this.authUser = authUser this.launcherVersion = launcherVersion this.forgeModListFile = path.join(this.gameDir, 'forgeMods.list') // 1.13+ @@ -198,7 +207,7 @@ class ProcessBuilder { } _lteMinorVersion(version) { - return Number(this.forgeData.id.split('-')[0].split('.')[1]) <= Number(version) + return Number(this.modManifest.id.split('-')[0].split('.')[1]) <= Number(version) } /** @@ -210,7 +219,7 @@ class ProcessBuilder { if(this._lteMinorVersion(9)) { return false } - const ver = this.forgeData.id.split('-')[2] + const ver = this.modManifest.id.split('-')[2] const pts = ver.split('.') const min = [14, 23, 3, 2655] for(let i=0; i { @@ -563,7 +558,7 @@ class ProcessBuilder { * @returns {Array.} An array containing the arguments required by forge. */ _resolveForgeArgs(){ - const mcArgs = this.forgeData.minecraftArguments.split(' ') + const mcArgs = this.modManifest.minecraftArguments.split(' ') const argDiscovery = /\${*(.*)}/ // Replace the declared variables with their proper values. @@ -576,7 +571,7 @@ class ProcessBuilder { val = this.authUser.displayName.trim() break case 'version_name': - //val = versionData.id + //val = vanillaManifest.id val = this.server.rawServer.id break case 'game_directory': @@ -586,7 +581,7 @@ class ProcessBuilder { val = path.join(this.commonDir, 'assets') break case 'assets_index_name': - val = this.versionData.assets + val = this.vanillaManifest.assets break case 'auth_uuid': val = this.authUser.uuid.trim() @@ -601,7 +596,7 @@ class ProcessBuilder { val = '{}' break case 'version_type': - val = this.versionData.type + val = this.vanillaManifest.type break } if(val != null){ @@ -679,7 +674,7 @@ class ProcessBuilder { if(!mcVersionAtLeast('1.17', this.server.rawServer.minecraftVersion) || this.usingFabricLoader) { // Add the version.jar to the classpath. // Must not be added to the classpath for Forge 1.17+. - const version = this.versionData.id + const version = this.vanillaManifest.id cpArgs.push(path.join(this.commonDir, 'versions', version, version + '.jar')) } @@ -718,7 +713,7 @@ class ProcessBuilder { const nativesRegex = /.+:natives-([^-]+)(?:-(.+))?/ const libs = {} - const libArr = this.versionData.libraries + const libArr = this.vanillaManifest.libraries fs.ensureDirSync(tempNativePath) for(let i=0; i Number(v)) - - if(verSplit[0] === 31) { - for(let i=0; i minWorking[i]) { - return false - } else if(verSplit[i] < minWorking[i]) { - return true - } - } - } - - return false - } - } module.exports = ProcessBuilder \ No newline at end of file