const mojang = require('mojang') const uuidV4 = require('uuid/v4') const path = require('path') const child_process = require('child_process') const ag = require('./assetguard.js') const fs = require('fs') const unzip = require('unzip') const mkpath = require('mkdirp'); launchMinecraft = function(versionData, basePath){ const authPromise = mojang.auth('EMAIL', 'PASS', uuidV4(), { name: 'Minecraft', version: 1 }) authPromise.then(function(data){ const args = finalizeArguments(versionData, data, basePath) //TODO make this dynamic const child = child_process.spawn('C:\\Program Files\\Java\\jre1.8.0_131\\bin\\javaw.exe', args) }) } finalizeArguments = function(versionData, authData, basePath){ const mcArgs = versionData['minecraftArguments'] const gameProfile = authData['selectedProfile'] const regex = new RegExp('\\${*(.*)}') const argArr = mcArgs.split(' ') argArr.unshift('net.minecraft.client.main.Main') argArr.unshift(classpathArg(versionData, basePath)) argArr.unshift('-cp') argArr.unshift('-Djava.library.path=' + path.join(basePath, 'natives')) argArr.unshift('-Xmn128M') argArr.unshift('-XX:-UseAdaptiveSizePolicy') argArr.unshift('-XX:+CMSIncrementalMode') argArr.unshift('-XX:+UseConcMarkSweepGC') argArr.unshift('-Xmx1G') for(let i=0; i -1){ shouldExclude = true } }) if(shouldExclude){ entry.autodrain() } else { mkpath.sync(path.join(nativePath, fileName, '..')) entry.pipe(fs.createWriteStream(path.join(nativePath, fileName))) } }) cpArgs.push(to) } } }) return cpArgs.join(';') } module.exports = { launchMinecraft }