Skip to content

Commit

Permalink
Use --fml.modLists instead of --fml.mods to avoid potential cli lengt…
Browse files Browse the repository at this point in the history
…h limit issues.
  • Loading branch information
dscalzi committed Sep 6, 2020
1 parent e6897da commit cc86f2a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
48 changes: 37 additions & 11 deletions app/assets/js/processbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ProcessBuilder {
this.forgeData = forgeData
this.authUser = authUser
this.launcherVersion = launcherVersion
this.forgeModListFile = path.join(this.gameDir, 'forgeMods.list') // 1.13+
this.fmlDir = path.join(this.gameDir, 'forgeModList.json')
this.llDir = path.join(this.gameDir, 'liteloaderModList.json')
this.libPath = path.join(this.commonDir, 'libraries')
Expand All @@ -44,17 +45,18 @@ class ProcessBuilder {

// Mod list below 1.13
if(!Util.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
this.constructModList('forge', modObj.fMods, true)
this.constructJSONModList('forge', modObj.fMods, true)
if(this.usingLiteLoader){
this.constructModList('liteloader', modObj.lMods, true)
this.constructJSONModList('liteloader', modObj.lMods, true)
}
}

const uberModArr = modObj.fMods.concat(modObj.lMods)
let args = this.constructJVMArguments(uberModArr, tempNativePath)

if(Util.mcVersionAtLeast('1.13', this.server.getMinecraftVersion())){
args = args.concat(this.constructModArguments(modObj.fMods))
//args = args.concat(this.constructModArguments(modObj.fMods))
args = args.concat(this.constructModList(modObj.fMods))
}

logger.log('Launch Arguments:', args)
Expand Down Expand Up @@ -224,7 +226,7 @@ class ProcessBuilder {
* @param {Array.<Object>} mods An array of mods to add to the mod list.
* @param {boolean} save Optional. Whether or not we should save the mod list file.
*/
constructModList(type, mods, save = false){
constructJSONModList(type, mods, save = false){
const modList = {
repositoryRoot: ((type === 'forge' && this._requiresAbsolute()) ? 'absolute:' : '') + path.join(this.commonDir, 'modstore')
}
Expand All @@ -249,27 +251,51 @@ class ProcessBuilder {
return modList
}

// /**
// * Construct the mod argument list for forge 1.13
// *
// * @param {Array.<Object>} mods An array of mods to add to the mod list.
// */
// constructModArguments(mods){
// const argStr = mods.map(mod => {
// return mod.getExtensionlessID()
// }).join(',')

// if(argStr){
// return [
// '--fml.mavenRoots',
// path.join('..', '..', 'common', 'modstore'),
// '--fml.mods',
// argStr
// ]
// } else {
// return []
// }

// }

/**
* Construct the mod argument list for forge 1.13
*
* @param {Array.<Object>} mods An array of mods to add to the mod list.
*/
constructModArguments(mods){
const argStr = mods.map(mod => {
constructModList(mods) {
const writeBuffer = mods.map(mod => {
return mod.getExtensionlessID()
}).join(',')
}).join('\n')

if(argStr){
if(writeBuffer) {
fs.writeFileSync(this.forgeModListFile, writeBuffer, 'UTF-8')
return [
'--fml.mavenRoots',
path.join('..', '..', 'common', 'modstore'),
'--fml.mods',
argStr
'--fml.modLists',
this.forgeModListFile
]
} else {
return []
}

}

_processAutoConnectArg(args){
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"devDependencies": {
"cross-env": "^7.0.2",
"electron": "^9.2.1",
"electron": "^9.3.0",
"electron-builder": "^22.8.0",
"eslint": "^7.8.1"
},
Expand Down

0 comments on commit cc86f2a

Please sign in to comment.