Deprecated start, fixed download hanging

This commit is contained in:
Pierce 2019-04-25 08:57:46 -04:00
parent fd5b201143
commit f90c2b89af
3 changed files with 2 additions and 7 deletions

View file

@ -93,7 +93,6 @@ If you are loading up a client outside of vanilla Minecraft and Forge (Optifine
| `close` | Integer | Code number that is returned by the Minecraft Process | | `close` | Integer | Code number that is returned by the Minecraft Process |
| `error` | String | Emitted when the Minecraft Process errors | | `error` | String | Emitted when the Minecraft Process errors |
| `package-extract` | null | Emitted when `clientPackage` finishes being extracted | | `package-extract` | null | Emitted when `clientPackage` finishes being extracted |
| `start` | null | Emitted after `launchArguments` are set. THIS WILL BE DEPRECATED AS ITS NOT ACCURATE |
| `download` | String | Emitted when a file successfully downloads | | `download` | String | Emitted when a file successfully downloads |
| `download-status` | Object | Emitted when data is received while downloading | | `download-status` | Object | Emitted when data is received while downloading |
#### Client Package Function #### Client Package Function

View file

@ -10,7 +10,7 @@ function downloadAsync (url, directory, name) {
return new Promise(resolve => { return new Promise(resolve => {
shelljs.mkdir('-p', directory); shelljs.mkdir('-p', directory);
const _request = request(url); const _request = request(url, {timeout: 10000});
_request.on('error', function(error) { _request.on('error', function(error) {
resolve({ resolve({

View file

@ -48,12 +48,9 @@ module.exports = async function (options) {
if(forge) { if(forge) {
classPaths.push(`${options.forge.path};${forge.paths.join(';')};${classes.join(';')};${mcPath}`); classPaths.push(`${options.forge.path};${forge.paths.join(';')};${classes.join(';')};${mcPath}`);
classPaths.push(forge.forge.mainClass) classPaths.push(forge.forge.mainClass)
} else if(custom) {
classPaths.push(`${classes.join(";")};${mcPath}`);
classPaths.push(custom.mainClass);
} else { } else {
classPaths.push(`${mcPath};${classes.join(";")}`); classPaths.push(`${mcPath};${classes.join(";")}`);
classPaths.push(versionFile.mainClass); classPaths.push(versionFile.mainClass || custom.mainClass);
} }
// Download version's assets // Download version's assets
@ -66,7 +63,6 @@ module.exports = async function (options) {
const launchArguments = args.concat(jvm, classPaths, launchOptions); const launchArguments = args.concat(jvm, classPaths, launchOptions);
const minecraft = child.spawn(options.javaPath ? options.javaPath : 'java', launchArguments); const minecraft = child.spawn(options.javaPath ? options.javaPath : 'java', launchArguments);
event.emit('start', null);
minecraft.stdout.on('data', (data) => event.emit('data', data)); minecraft.stdout.on('data', (data) => event.emit('data', data));
minecraft.stderr.on('data', (data) => event.emit('error', data)); minecraft.stderr.on('data', (data) => event.emit('error', data));
minecraft.on('close', (code) => event.emit('close', code)); minecraft.on('close', (code) => event.emit('close', code));