Change required args from 9 to 5. New event

Event allows you to see the launch arguments for debugging.
This commit is contained in:
Pierce 2019-04-26 13:03:39 -04:00
parent 4b2393544b
commit e207529dac
3 changed files with 3 additions and 1 deletions

View file

@ -89,6 +89,7 @@ If you are loading up a client outside of vanilla Minecraft and Forge (Optifine
| Event Name | Type | Description |
|-------------------|---------|---------------------------------------------------------------------------------------|
| `arguments` | Object | Emitted when launch arguments are set for the Minecraft Jar. |
| `data` | Buffer | Emitted when information is returned from the Minecraft Process |
| `close` | Integer | Code number that is returned by the Minecraft Process |
| `error` | String | Emitted when the Minecraft Process errors |

View file

@ -262,7 +262,7 @@ module.exports.getLaunchOptions = function (version, modification, options) {
let arguments = type.minecraftArguments ? type.minecraftArguments.split(' ') : type.arguments.game;
const assetPath = version.assets === "legacy" || version.assets === "pre-1.6" ? path.join(options.root, 'assets', 'legacy') : path.join(options.root, 'assets');
if(arguments.length < 9) arguments = arguments.concat(version.minecraftArguments ? version.minecraftArguments.split(' ') : version.arguments.game);
if(arguments.length < 5) arguments = arguments.concat(version.minecraftArguments ? version.minecraftArguments.split(' ') : version.arguments.game);
const fields = {
'${auth_access_token}': options.authorization.access_token,

View file

@ -61,6 +61,7 @@ module.exports = async function (options) {
const launchOptions = await handler.getLaunchOptions(versionFile, modification, options);
const launchArguments = args.concat(jvm, classPaths, launchOptions);
event.emit('arguments', launchArguments);
const minecraft = child.spawn(options.javaPath ? options.javaPath : 'java', launchArguments);
minecraft.stdout.on('data', (data) => event.emit('data', data));