Comments (3)
My example code
const { Client } = require('minecraft-launcher-core')
const launcher = new Client();
let opts = {
// For production launchers, I recommend not passing
// the getAuth function through the authorization field and instead
// handling authentication outside before you initialize
// MCLC so you can handle auth based errors and validation!
authorization: {
access_token: '',
client_token: '',
uuid: '',
name: 'testusr',
user_properties: '{}',
meta: {
type: 'mojang',
demo: false,
}
},
root: "./mctest",
forge: "./forge-1.12.2-14.23.5.2860-universal.jar",
version: {
number: "1.12.2",
type: "release"
},
memory: {
max: "6G",
min: "4G"
}
}
launcher.launch(opts);
launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));
launcher.on('progress', function (e) {
console.log("======> ", e.task, " ИЗ ", e.total);
});
launcher.on('download-status', function (e) {
console.log(e.name, ">", e.current, " ИЗ ", e.total);
});
from minecraftlauncher-core.
However, since you are trying to launch Forge for 1.12.2, the system is a little bit different. Instead of specifying the jar file, you should use the Client
function to install Forge for you, and then you can use the installed Forge version to launch the game.
Here is a simple example of how you might do this:
const launcher = new Client();
let opts = {
authorization: {
access_token: '',
client_token: '',
uuid: '',
name: 'testusr',
user_properties: '{}',
meta: {
type: 'mojang',
demo: false,
}
},
root: "./mctest",
version: {
number: "1.12.2-forge1.12.2-14.23.5.2859",
type: "release"
},
memory: {
max: "6G",
min: "4G"
}
};
const installer = new Installer({
root: "./mctest",
version: "1.12.2",
forge: '14.23.5.2859'
});
installer.install('forge')
.then(() => {
console.log('Forge installed');
launcher.launch(opts);
})
.catch(console.error);
launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));
launcher.on('progress', function (e) {
console.log("======> ", e.task, " ИЗ ", e.total);
});
launcher.on('download-status', function (e) {
console.log(e.name, ">", e.current, " ИЗ ", e.total);
});
I'm not sure if this will work, but give it a try. It should work.
from minecraftlauncher-core.
Hey Seeroy, use the installer jar when trying to launch forge with 1.12.2 past installer version 2847
, as the universal jar for 1.12.2 uses a different installer system.
from minecraftlauncher-core.
Related Issues (20)
- How to run Fogre version HOT 1
- MinecraftLauncher-core for 1.19.3 HOT 2
- Can i disable command prompt when minecarft is launching? HOT 1
- Error when connecting to server HOT 1
- How do I show the log in my electron app instead of in console? HOT 4
- [BUG] Error when we're launching Minecraft with `options.version.custom` to `fabric`
- can't join your discord HOT 4
- ES6 syntax HOT 1
- Error with ForgeWrapper after update HOT 1
- Error launching game instances
- Error with Electron HOT 1
- How run "offline" account? HOT 2
- Issues Launching 1.19 HOT 1
- Unable to launch OptiFine 1.18 HOT 8
- [Feature request] Library overrides HOT 2
- Black microscopic window on custom jar launch HOT 6
- SyntaxError · Unexpected token u in JSON at position 0 HOT 2
- Problem forbidden launch. HOT 3
- Error starting optifine or custom Jar HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minecraftlauncher-core.