mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-12-23 02:13:46 +03:00
Events
This commit is contained in:
parent
4202eb201c
commit
2b6fa2a973
4 changed files with 10 additions and 6 deletions
3
components/events.js
Normal file
3
components/events.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
const event = require('events');
|
||||
|
||||
module.exports = new event.EventEmitter();
|
|
@ -1,4 +1,5 @@
|
|||
const child = require('child_process');
|
||||
const event = require('./events');
|
||||
const path = require('path');
|
||||
const handler = require('./handler');
|
||||
const fs = require('fs');
|
||||
|
@ -53,8 +54,8 @@ module.exports = async function (options) {
|
|||
const arguments = args.concat(memory, jvm, classPaths, launchOptions);
|
||||
const minecraft = child.spawn("java", arguments);
|
||||
|
||||
|
||||
minecraft.stdout.on('data', (data) => {console.log(`[Minecraft] ${data}`)});
|
||||
minecraft.stderr.on('data', (data) => {console.error(`[Error] ${data}`)});
|
||||
minecraft.on('close', (code) => {console.log(`Minecraft closed with code ${code}`)});
|
||||
event.emit('start', null);
|
||||
minecraft.stdout.on('data', (data) => event.emit('data', data));
|
||||
minecraft.stderr.on('data', (data) => event.emit('error', data));
|
||||
minecraft.on('close', (code) => event.emit('close', code));
|
||||
};
|
2
index.js
2
index.js
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
core: require('./components/launcher'),
|
||||
|
||||
event: require('./components/events'),
|
||||
handler: require('./components/handler'),
|
||||
authenticator: require('./components/authenticator'),
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minecraft-launcher-core",
|
||||
"version": "1.0.6",
|
||||
"version": "1.1.0",
|
||||
"description": "Module that downloads Minecraft assets and runs Minecraft.",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue