Giter Club home page Giter Club logo

minecraftlauncher-core's Introduction

logo

Project rewrite coming soon™

Build Status License: MIT version

MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself. Basically a core for your Electron or script based launchers.

Getting support

I've created a Discord server for anyone who needs to get in contact with me or get help!

chat on Discord

Installing

npm i minecraft-launcher-core

Standard Example

const { Client, Authenticator } = 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: Authenticator.getAuth("username", "password"),
    root: "./minecraft",
    version: {
        number: "1.14",
        type: "release"
    },
    memory: {
        max: "6G",
        min: "4G"
    }
}

launcher.launch(opts);

launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));

Documentation

Client Functions

Function Type Description
launch Promise Launches the client with the specified options as a parameter. Returns child the process
launch
Parameter Type Description Required
options.clientPackage String Path or URL to a zip file, which will be extracted to the root directory. (Not recommended for production use) False
options.removePackage Boolean Option to remove the client package zip file after its finished extracting. False
options.root String Path where you want the launcher to work in. C:/Users/user/AppData/Roaming/.mc True
options.cache String Path where launcher files will be cached in. C:/Users/user/AppData/Roaming/.mc/cache False
options.os String windows, osx or linux. MCLC will auto determine the OS if this field isn't provided. False
options.customLaunchArgs Array Array of custom Minecraft arguments you want to add. False
options.customArgs Array Array of custom Java arguments you want to add. False
options.features Array Array of game argument feature flags. ex: is_demo_user or has_custom_resolution False
options.version.number String Minecraft version that is going to be launched. True
options.version.type String Any string. The actual Minecraft launcher uses release and snapshot. True
options.version.custom String The name of the folder, jar file, and version json in the version folder. False
options.memory.max String Max amount of memory being used by Minecraft. True
options.memory.min String Min amount of memory being used by Minecraft. True
options.forge String Path to Forge Jar. (Versions below 1.12.2 should be the "universal" jar while versions above 1.13 should be the "installer" jar) False
options.javaPath String Path to the JRE executable file, will default to java if not entered. False
options.quickPlay.type String The type of the quickPlay session. singleplayer, multiplayer, realms, legacy False
options.quickPlay.identifier String The folder name, server address, or realm ID, relating to the specified type. legacy follows multiplayer format. False
options.quickPlay.path String The specified path for logging (relative to the run directory) False
options.proxy.host String Host url to the proxy, don't include the port. False
options.proxy.port String Port of the host proxy, will default to 8080 if not entered. False
options.proxy.username String Username for the proxy. False
options.proxy.password String Password for the proxy. False
options.timeout Integer Timeout on download requests. False
options.window.width String Width of the Minecraft Client. False
options.window.height String Height of the Minecraft Client. False
options.window.fullscreen Boolean Fullscreen the Minecraft Client. False
options.overrides Object Json object redefining paths for better customization. Example below. False

IF YOU'RE NEW TO MCLC, LET IT HANDLE EVERYTHING! DO NOT USE OVERRIDES!

let opts = {
   otherOps...,
   overrides: {
       gameDirectory: '', // where the game process generates folders like saves and resource packs.
       minecraftJar: '',
       versionName: '', // replaces the value after the version flag.
       versionJson: '',
       directory: '', // where the Minecraft jar and version json are located.
       natives: '', // native directory path.
       assetRoot: '',
       assetIndex: '',
       libraryRoot: '',
       cwd: '', // working directory of the java process.
       detached: true, // whether or not the client is detached from the parent / launcher.
       classes: [], // all class paths are required if you use this.
       minArgs: 11, // The amount of launch arguments specified in the version file before it adds the default again
       maxSockets: 2, // max sockets for downloadAsync.
       // The following is for launcher developers located in countries that have the Minecraft and Forge resource servers
       // blocked for what ever reason. They obviously need to mirror the formatting of the original JSONs / file structures.
       url: {
           meta: 'https://launchermeta.mojang.com', // List of versions.
           resource: 'https://resources.download.minecraft.net', // Minecraft resources.
           mavenForge: 'http://files.minecraftforge.net/maven/', // Forge resources.
           defaultRepoForge: 'https://libraries.minecraft.net/', // for Forge only, you need to redefine the library url
                                                                // in the version json.
           fallbackMaven: 'https://search.maven.org/remotecontent?filepath='
       },
       // The following is options for which version of ForgeWrapper MCLC uses. This allows us to launch modern Forge.
       fw: {
        baseUrl: 'https://github.com/ZekerZhayard/ForgeWrapper/releases/download/',
        version: '1.5.1',
        sh1: '90104e9aaa8fbedf6c3d1f6d0b90cabce080b5a9',
        size: 29892,
      },
      logj4ConfigurationFile: ''
   }
}

Notes

Custom

If you are loading up a client outside of vanilla Minecraft or Forge (Optifine and for an example), you'll need to download the needed files yourself if you don't provide downloads url downloads like Forge and Fabric. If no version jar is specified, MCLC will default back to the normal MC jar so mods like Fabric work.

Authentication (Deprecated)

MCLC's authenticator module does not support Microsoft authentication. You will need to use a library like MSMC. If you want to create your own solution, the following is the authorization JSON object format.

{
    access_token: '',
    client_token: '',
    uuid: '',
    name: '',
    user_properties: '{}',
    meta: {
        type: 'mojang' || 'msa',
        demo: true || false, // Demo can also be specified by adding 'is_demo_user' to the options.feature array 
        // properties only exists for specific Minecraft versions.
        xuid: '',
        clientId: ''
    }
}

Authenticator Functions

getAuth
Parameter Type Description Required
username String Email or username True
password String Password for the Mojang account being used if online mode. False
client_token String Client token that will be used. If one is not specified, one will be generated False
validate
Parameter Type Description Required
access_token String Token being checked if it can be used to login with (online mode). True
client_token String Client token being checked to see if there was a change of client (online mode). True
refreshAuth
Parameter Type Description Required
access_token String Token being checked if it can be used to login with (online mode). True
client_token String Token being checked if it's the same client that the access_token was created from. True
invalidate
Parameter Type Description Required
access_token String Token being checked if it can be used to login with (online mode). True
client_token String Token being checked if it's the same client that the access_token was created from. True
signOut
Parameter Type Description Required
username String Username used to login with True
password String Password used to login with True
changeApiUrl
Parameter Type Description Required
url String New URL that MCLC will make calls to authenticate the login. True

Events

Event Name Type Description
arguments Object Emitted when launch arguments are set for the Minecraft Jar.
data String Emitted when information is returned from the Minecraft Process
close Integer Code number that is returned by the Minecraft Process
package-extract null Emitted when clientPackage finishes being extracted
download String Emitted when a file successfully downloads
download-status Object Emitted when data is received while downloading
debug String Emitted when functions occur, made to help debug if errors occur
progress Object Emitted when files are being downloaded in order. (Assets, Forge, Natives, Classes)

What should it look like running from console?

The pid is printed in console after the process is launched. gif

Contributors

These are the people that helped out that aren't listed here!

  • Pyker - Forge dependency parsing.
  • Khionu - Research on how Minecraft'snatives are handled.
  • Coding-Kiwi - Pointed out I didn't pass clientToken in initial authentication function.
  • maxbsoft - Pointed out that a certain JVM option causes OSX Minecraft to bug out.
  • Noé - Pointed out launch args weren't being passed for Forge 1.13+.

minecraftlauncher-core's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minecraftlauncher-core's Issues

Fails to download com/typesafe dependencies properly for forge

When running Minecraft Forge, libraries at com/typesafe/akka and com/typesafe/config are both being downloaded with the wrong URL. Instead of a jar being returned a 404 page is being returned:

<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

I'd, at least, expect an error to be thrown instead of it silently failing.

I suspect this is due to some bug in the forge library download URL calculation. I'll go ahead and see if I can fix this, but that code looks decently complex so I'm not sure if I'll be able to fix it quickly.

Details

Minecraft Forge: 14.23.5.2847
Minecraft: 1.12.2

URLs:

Log of looking into this.

Running Wireshark against a new 1.12.2 install of forge to see what URL it's using (thanks for using HTTP by default forge....)

OK, found out it's checking for a .jar.pack.xz first, if THAT'S not found then it'll fallback to the .jar, but it looks like .jar.pack.xz is the only one that exists for what we want. We probably want to handle that and extract the file.

wireshark

Update: Turns out .pack.xz is some proprietary java bullshit, so working on figuring out how this will work. I don't really want to spend the next two weeks writing a node.js decompression package for this.

Another Update: unpack200 appears to be provided in the JRE, so verifying that bot linux and windows have this in their PATH, if so, I'll just child_process.spawn it.

Final update for the night: It is provided in the JRE, but for some reason it's not in PATH for windows, so going to figure that one out.

Cannot read property 'classifier' of undefined

Hello, I am making a Minecraft Launcher and I am new to MCLC. I was testing MCLC out so I faced this error. This is my code for my MCLC test:

const { Client, Authenticator } = require('minecraft-launcher-core');
const launcher = new Client();

let opts = {
    clientPackage: null,
    //I am authing in offline mode:
    authenticator: Authenticator.getAuth("iammithani"),
    root: "../../../AppData/Roaming/.minecraft",
    version: {
        number: "1.16.4",
        type: "release",
        custom: "Optifine 1.16.4"
    },
    memory: {
        max: "6G",
        min: "4G"
    }
}

launcher.launch(opts);

launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));

Please tell me how do I fix this? Please send me the code of how to fix it.

A fatal error has been detected by the JRE

OS: Arch Linux (running with AwesomeWM)
CPU: Ryzen 5 2600 (included in the log)
GPU: GTX 1660 (included in the log)
MLC version: 3.16.7 (included in the screenshot)
NodeJS version: 16.8.0
Java version: 16.0.2 (OpenJDK) (included in the log)
Log: hs_err_pid6146.log
Coding setup

Greetings!
A friend and I were joking about some clients until I decided to code my own one. I just changed a few default settings etc for the beginning. Now I wanted to test launching the exported client via MLC. Unfortunately Java prints out a "fatal" error. I didn't find any solution online, so I try to ask here. Do you know if this is a error on my side or in MLC? How can I/we fix it?
Have a great day!

Microsoft authentification

hello I created a Minecraft launcher from a library based on Minecraft launcher core (I am now at the Microsoft authentication part)

I would like to know do you have a discord server so that one can help me to set up the Microsoft authentication part

Authenticator should send clientToken

As stated in https://wiki.vg/Authentication calls to the /authenticate endpoint should include a clientToken.
Currently, a clientToken is generated in the Authenticator.getAuth function, but it is not passed to the /authenticate endpoint, as a result you get an accessToken that has no associated clientToken.

Authenticator.validate does not send the clientToken, currently that is correct since the accessToken is generated without one.

Authenticator.refresh however does send the clientToken but it is ignored since the access token is generated without one.
same for Authenticator.invalidate

MacOS(11.3) - Failed to load minecraft main class

Hello!
I'm trying to launch minecraft on macos 11.3(Intel chip).
But I got a error:

---- Minecraft Crash Report ----
// Why did you do that?

Time: 2021/5/11 下午9:32
Description: Initializing game

java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib
	at org.lwjgl.system.Library.loadSystem(Library.java:147)
	at org.lwjgl.system.Library.loadSystem(Library.java:67)
	at org.lwjgl.system.Library.<clinit>(Library.java:50)
	at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
	at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:61)
	at cub.a(SourceFile:106)
	at com.mojang.blaze3d.platform.GLX.initGlfw(SourceFile:191)
	at cvi.av(SourceFile:459)
	at cvi.b(SourceFile:395)
	at net.minecraft.client.main.Main.main(SourceFile:154)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
	at org.lwjgl.system.Library.loadSystem(Library.java:147)
	at org.lwjgl.system.Library.loadSystem(Library.java:67)
	at org.lwjgl.system.Library.<clinit>(Library.java:50)
	at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
	at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:61)
	at cub.a(SourceFile:106)
	at com.mojang.blaze3d.platform.GLX.initGlfw(SourceFile:191)
	at cvi.av(SourceFile:459)

-- Initialization --
Details:
Stacktrace:
	at cvi.b(SourceFile:395)
	at net.minecraft.client.main.Main.main(SourceFile:154)

-- System Details --
Details:
	Minecraft Version: 1.14
	Operating System: Mac OS X (x86_64) version 10.16
	Java Version: 16, Azul Systems, Inc.
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Azul Systems, Inc.
	Memory: 4130782744 bytes (3939 MB) / 4294967296 bytes (4096 MB) up to 6442450944 bytes (6144 MB)
	JVM Flags: 4 total; -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Xmx6G -Xms4G
	Launched Version: 1.14
	LWJGL: 3.2.1 build 12
	OpenGL: ~~ERROR~~ NoClassDefFoundError: Could not initialize class org.lwjgl.system.Library
	GL Caps: 
	Using VBOs: Yes
	Is Modded: Probably not. Jar signature remains and client brand is untouched.
	Type: Client (map_client.txt)
	Resource Packs: 
	Current Language: ~~ERROR~~ NullPointerException: Cannot invoke "dve.b()" because "this.ax" is null
	CPU: <unknown>

I have already seen #35
I add os options in my script:

const { Client, Authenticator } = require('minecraft-launcher-core');
const launcher = new Client();

let opts = {
    clientPackage: null,
    // 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!
    
    os: "osx",
    authorization: Authenticator.getAuth("xxx", "xxx"),
    root: "./minecraft",
    version: {
        number: "1.14",
        type: "release"
    },

    memory: {
        max: "6G",
        min: "2G"
    }
}

launcher.launch(opts);
launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));

But it is dones't work!

How to run OptiFine?

I trying
version: { number: "1.8.8", type: "release", custom: "OptiFine 1.8.8" },

and getting
Error: Could not find or load main class net.minecraft.launchwrapper.Launch

Add in support for Optifine-Client or other custom clients

Hello! Is there any way to open a custom client, such as versions/1.7.10-Optifine_HD_U_E7, or just a custom / modified client in general? I tried to open the game, but couldn't manage to find out how to do it the way I want it. I'd really appreciate if you could help me achieve this.

error on "gpu_init.cc" on launching game : "passthrough is not supported"

Hi, I have a pretty weird issue, after the my-launcher-core implementation to launch the game, I tried it and everything was working fine.
However, now it throws an error just after extracting client package.

It is the following:
"[8248:1225/203934.854:ERROR:gpu_init.cc(457)] Passthrough is not supported, GL is disabled, ANGLE is"

This is even more weird because I don't have the end of the sentence.

If you have an idea of why this is occuring, please tell me.
Thanks for your help

Assets are not downloaded properly in some cases.

OS: Debian
MC Version: 1.13.2

On first launch on a empty directory as the root dir, the game crashes immediately. On the second launch game crashes when a menu button is pressed (and the game complains about missing pack.mcmeta). Third launch, the game launches fine with no missing assets. After replicating this many times, it happens every time.

Start a cracked client

Will starting a minecraft client without providing login details or that isn't authenticated with a mojang or Microsoft account. will that work?

OS Edgecase: MacOS Catalina (10.15.2)

Hello! I just tried to use example from this repository and received exception after launch:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path: [/Users/Tobishua/tests/minecraft/natives/1.12.2] at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670) at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:806) at java.base/java.lang.System.loadLibrary(System.java:1909) at org.lwjgl.Sys$1.run(Sys.java:73) at java.base/java.security.AccessController.doPrivileged(AccessController.java:312) at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) at org.lwjgl.Sys.loadLibrary(Sys.java:95) at org.lwjgl.Sys.<clinit>(Sys.java:112) at bib.I(SourceFile:2825) at net.minecraft.client.main.Main.main(SourceFile:38)

Here is my test script (I've leave example code from this repository):
`const { Client, Authenticator } = require('minecraft-launcher-core');
const launcher = new Client();

let opts = {
clientPackage: null,
// 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: Authenticator.getAuth("---------", "---------"),
root: "./minecraft",
os: "osx",
version: {
number: "1.12.2",
type: "release"
},
memory: {
max: "4000",
min: "1000"
}
}

launcher.launch(opts);

launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));`

(Mac) java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib

Using the sample code from NPM on a Mac creates this error when launching the game (1.14 vanilla).
The native files are being downloaded by the launcher into minecraft/natives/1.14

Have tried specifying the path using -Djava.library.path and also tried using chmod to make the files executable.

I have pasted the full error below:

// Why is it breaking :(

Time: 10/07/2021, 22:09
Description: Initializing game

java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib
        at org.lwjgl.system.Library.loadSystem(Library.java:147)
        at org.lwjgl.system.Library.loadSystem(Library.java:67)
        at org.lwjgl.system.Library.<clinit>(Library.java:50)
        at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
        at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:61)
        at cub.a(SourceFile:106)
        at com.mojang.blaze3d.platform.GLX.initGlfw(SourceFile:191)
        at cvi.av(SourceFile:459)
        at cvi.b(SourceFile:395)
        at net.minecraft.client.main.Main.main(SourceFile:154)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
        at org.lwjgl.system.Library.loadSystem(Library.java:147)
        at rg.lwjgl.system.Library.loadSystem(Library.java:67)
        at org.lwjgl.system.Library.<clinit>(Library.java:50)
        at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
        at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:61)
        at cub.a(SourceFile:106)
        at com.mojang.blaze3d.platform.GLX.initGlfw(SourceFile:191)
        at cvi.av(SourceFile:459)

-- Initialization --
Details:
Stacktrace:
        at cvi.b(SourceFile:395)
        at net.minecraft.client.main.Main.main(SourceFile:154)

-- System Details --
Details:
        Minecraft Version: 1.14
        Operating System: Mac OS X (aarch64) version 11.4
        Java Version: 16.0.1, Azul Systems, Inc.
        Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Azul Systems, Inc.
        Memory: 3925952392 bytes (3744 MB) / 4294967296 bytes (4096 MB) up to 6442450944 bytes (6144 MB)
        JVM Flags: 4 total; -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Xmx6G -Xms4G
        Launched Version: 1.14
        LWJGL: 3.2.1 build 12
        OpenGL: ~~ERROR~~ NoClassDefFoundError: Could not initialize class org.lwjgl.system.Library
        GL Caps:
        Using VBOs: Yes
        Is Modded: Probably not. Jar signature remains and client brand is untouched.
        Type: Client (map_client.txt)
        Resource Packs:
        Current Language: ~~ERROR~~ NullPointerException: Cannot invoke "dve.b()" because "this.ax" is null
        CPU: <unknown>

#@!@# Game crashed! Crash report saved to: #@!@# /Users/tomaz/Haven/cablepost-test/minecraft/crash-reports/crash-2021-07-10_22.09.09-client.txt

Custom Minecraft args won't work

Because Custom Minecraft arguments (for MCP maily) won't work using options.customArgs, because Minecraft arguments have to be after the -cp.

Therefore, an options.customLaunchArgs options might be added.

May Benchmark - Features

Even though we're at 2.7.0, we're still missing some things that would be really helpful!

Features I'm probably going to add are:

  • Checksum

This is needed, as there's no check to see if the files properly downloaded.

  • Better logging

Yep! As if now, there isn't a lot of logging and debugging events in the formatting functions. If a launcher wanted to log everything to a file, they should be able to do it!

  • Reformat debug messages

Make everything more clear.


This list will continue to grow as I see fit, please add any requests below if you have a cool idea!

E is undefined

With the 3.11 update, I forgot to change a variable name when moving code around so if the check java function errors itll break. My apologies, will fix when I get home (12 hours).

Problems installing the fabric

Hi, I'm having problems installing the fabric in my customized launcher folder.

Opts:
image

Folder:
image

Error:
image

Error in text:

`21:28:35.389 [main] ERROR FabricLoader - Could not find valid game provider!

Exception in thread "main" java.lang.RuntimeException: Could not find valid game provider!
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:96)
at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:28)

21:28:35.390 [main] ERROR FabricLoader - - Minecraft`

Issue with forge 1.13+

Not sure what's up since the class paths & everything else is the same as Mojang's, but it fails to launch. Need to look into.

(NoXe's Screenshot)
image

Rewrite breaks 1.6.4

What ever changed, 1.6.4 seems to have broke on launch. Works fine on MCLC version 2.8.0, so I'm assuming the rewrite was the reason why it broke in the first place. Will look into when I can :)

OSX native issues

Not sure why, but it seems 1.14.2 crashes due to missing natives. I'm going to assume I just didnt parse correctly, but I'll look into it when I get the chance

---- Minecraft Crash Report ----
// I just don't know what went wrong :(

Time: 7/23/19 10:20 AM
Description: Initializing game

java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib
    at org.lwjgl.system.Library.loadSystem(Library.java:147)
    at org.lwjgl.system.Library.loadSystem(Library.java:67)
    at org.lwjgl.system.Library.<clinit>(Library.java:50)
    at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
    at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:61)
    at cud.a(SourceFile:106)
    at com.mojang.blaze3d.platform.GLX.initGlfw(SourceFile:191)
    at cvk.au(SourceFile:459)
    at cvk.b(SourceFile:395)
    at net.minecraft.client.main.Main.main(SourceFile:154)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
    at org.lwjgl.system.Library.loadSystem(Library.java:147)
    at org.lwjgl.system.Library.loadSystem(Library.java:67)
    at org.lwjgl.system.Library.<clinit>(Library.java:50)
    at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:97)
    at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:61)
    at cud.a(SourceFile:106)
    at com.mojang.blaze3d.platform.GLX.initGlfw(SourceFile:191)
    at cvk.au(SourceFile:459)

-- Initialization --
Details:
Stacktrace:
    at cvk.b(SourceFile:395)
    at net.minecraft.client.main.Main.main(SourceFile:154)

-- System Details --
Details:
    Minecraft Version: 1.14.2
    Operating System: Mac OS X (x86_64) version 10.14.3
    Java Version: 1.8.0_222, AdoptOpenJDK
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), AdoptOpenJDK
    Memory: 885714168 bytes (844 MB) / 1029177344 bytes (981 MB) up to 6347554816 bytes (6053 MB)
    JVM Flags: 4 total; -XX:-UseAdaptiveSizePolicy -XX:-OmitSta...

ForgeWrapper Issue 1.5.5

Specific installers uploaded by the Forge team are broken and ForgeWrapper will break when trying to launch with them. The only solution at the moment is waiting until ForgeWrapper is patched.

Useless process in the natives function

Hello,
While I was reading your code for a personnel project, I realize that the 2 next line are useless for the installation process.

new zip(path.join(nativeDirectory, name)).extractAllTo(nativeDirectory, true);
shelljs.rm(path.join(nativeDirectory, name));

In the official Minecraft Launcher, the natives aren't extracted and are run like JAR files.

Validation error

launcher.authenticator.getAuth(username, password).then(function(auth) {
	launcher.core({
		authorization: auth,
		clientPackage: null,
		root: "C:/Users/admin/AppData/Roaming/.minecraft",
		os: "windows",
		version: {
			number: "1.8.8",
			type: "release"
		},
		memory: {
			max: "1024"
		}
	});
});```


C:\Users\admin\Desktop\myDB\node_modules\minecraft-launcher-core\components\authenticator.js:38
                throw new Error("Validation error: " + response.statusMessage);
                ^

Error: Validation error: Forbidden
    at Request._callback (C:\Users\admin\Desktop\myDB\node_modules\minecraft-launcher-core\components\authenticator.js:38:23)
    at Request.self.callback (C:\Users\admin\Desktop\myDB\node_modules\minecraft-launcher-core\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (C:\Users\admin\Desktop\myDB\node_modules\minecraft-launcher-core\node_modules\request\request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (C:\Users\admin\Desktop\myDB\node_modules\minecraft-launcher-core\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)

Could not find a declaration file for module 'minecraft-launcher-core'

Hey !
I cannot run my build because the module doesn't have a declaration file 😢
Plz help me 😭 i not found every where a solution for that
i tryied to install with @types and that's don't worked
i tryied too add a declaration file with (.d.ts) that's don't worked
i don(t found the issue of this problem snif

Forge Launch gets stuck at baking models, CPU usage spikes to constant 90+%

Good day everyone.

I made a small launcher for a few modpacks of mine, but when I tried to launch a modpack it got stuck at baking models.
It never gets stuck at the same model, and when it gets stuck the CPU just starts crunching something and I am not sure what.

Task Manager shows CPU usage at 90% or more. There is no crash log, and when I tried launching the modpack through an actual launcher that someone made it worked fine. It's in Electron, if that changes anything and the function is ran in the main.js file.

The version is 1.12.2, forge-1.12.2-14.23.5.2847-universal.jar.

Here is the function being called:

playModpack: function(id) {
    $.get('https://usernullifiedprod.github.io/json/launcher.json', function(data) {
        ipcRenderer.send("playPack", {
            id: id,
            username: store.get('username'),
            data: data,
            ram: store.get('modpack' + String(id) + '.ram')
        });
    });
}

This is the function itself:

ipcMain.on("playPack", (event, info) => {
    let currentForge = app.getPath('userData') + '\\Modpacks\\' + modpackNames[info.id - 1] + '\\forgeInstallers\\' + info.data['modpack' + String(info.id)].forgeFile + '.jar'
    if(info.username != undefined) {
      let startArgs = {
        clientPackage: null,
        authorization: Authenticator.getAuth(info.username),
        root: app.getPath('userData') + '/Modpacks/' + modpackNames[info.id - 1],
        version: {
            number: "1.12.2",
            type: "release"
        },
        memory: {
            max: parseInt(info.ram) * 1024,
            min: "2048"
        },
        customLaunchArgs: [
          '-Dfml.ignorePatchDiscrepancies=true',
          '-Dfml.ignoreInvalidMinecraftCertificates=true',
          '-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump',
          '-Xms256m',
          '-Xmx' + String(parseInt(info.ram) * 1024) + 'm'
        ],
        forge: currentForge
      }

      launcher.launch(startArgs);

      launcher.on('debug', (e) => console.log(e));
      launcher.on('data', (e) => console.log(e));
    } else {
      win.webContents.send("playPack undefinedUsername");
    }
  });

My question is if there is any way of fixing this, because I ran out of ideas when the custom args did not help.
If you need the mod list, or if this is not the right place to ask just tell me.

Thanks in advance!

Microsoft Login

As far as I can tell, there's no way to log in with Microsoft with the authenticator in this launcher.

Authenticator issues

Hello! I have recently found this project, but whenever I try to launch minecraft using it, I get this error:

[MCLC]: Parsed version from version manifest
[MCLC]: Set native path to C:\Users\PixelOrangeDev\Documents\Programming\NodeJS\MeteorMC\minecraft\natives\1.14
[MCLC]: Attempting to download Minecraft version jar
C:\Users\PixelOrangeDev\Documents\Programming\NodeJS\MeteorMC\node_modules\minecraft-launcher-core\components\authenticator.js:36
                throw new Error("Validation error: " + response.statusMessage);
                ^

Error: Validation error: Forbidden
    at Request._callback (C:\Users\PixelOrangeDev\Documents\Programming\NodeJS\MeteorMC\node_modules\minecraft-launcher-core\components\authenticator.js:36:23)
    at Request.self.callback (C:\Users\PixelOrangeDev\Documents\Programming\NodeJS\MeteorMC\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (C:\Users\PixelOrangeDev\Documents\Programming\NodeJS\MeteorMC\node_modules\request\request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (C:\Users\PixelOrangeDev\Documents\Programming\NodeJS\MeteorMC\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)

My lauchMinecraft file contains this:

const { Client, Authenticator } = require('minecraft-launcher-core');

let opts = {
    clientPackage: null,
    authorization: Authenticator.getAuth("BlockyPenguin", "**My Password**"),
    root: "./minecraft",
    os: "windows",
    version: {
        number: "1.14",
        type: "release"
    },
    memory: {
        max: "6000",
        min: "4000"
    }
}

const launcher = new Client();
launcher.launch(opts);

launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e.toString('utf-8')));
launcher.on('error', (e) => console.log(e.toString('utf-8')));

Can anyone help me please? thank you!

Request library is deprecated!

[1/4] Resolving packages...
warning minecraft-launcher-core > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

Add in support for Minecraft Forge

Hello! Can you please tell me how to launch a client with mods in your minecraft-launcher-core? Tried and failed. I would be very grateful for the help.

Getting error while launching with Optifine

Good afternoon again
I am testing a new update 2.0.0 and have discovered that some mods are taking off with full compliance with the versions
For example, when trying to run Forge's version with Optifine in the mods folder, it gives an error:
(It was tested on version 1.8.9 with forge-1.8.9-11.15.1.1722-universal and OptiFine_1.8.9_HD_U_I7)

$ node app
events.js:173
    throw err; // Unhandled 'error' event
    ^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (Exception in thread "Thread-12" )
    at EventEmitter.emit (events.js:171:17)
    at Socket.minecraft.stderr.on (D:\Users\Maksimetny\Desktop\ggmc\node_modules\minecraft-launcher-core\components\launcher.js:70:4
9)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

I haven't found any more errors) Thanks for the update

Error when trying to use clientPackage

Hi, I'm creating my own launcher and I'm using clientPackage to install from a website and put it in my launcher. The problem is that copy the file in the directory minecraft instead of versions and give me error. I fixed it changing the line 658 of handler.js:

new Zip(options.clientPackage).extractAllTo(options.root + "/versions", true)

I changed the extract route of root to versions and works fine.

Linux Error

Problem running on Linux (Mint 19)

As far as I understand, it is not removed to find a way to the directory of libraries
Created folders natives and versions (they contain files), libraries missing

File app.js

const launcher = require('minecraft-launcher-core');

launcher.authenticator.getAuth("Steve").then(auth => {
    // Save the auth to a file so it can be used later on!
    launcher.core({
        authorization: auth,
        clientPackage: null,
        forge: null,
        root: "/mnt/dev/launcher/mc",
        os: "linux",
        version: {
            number: "1.13.2",
            type: "release" 
        },
        memory: {
            max: "3000",
            min: "1000"
        }
    });
});

Console Log

user@otherPC:/mnt/dev/launcher$ node app
mkdir: no paths given
mkdir: no paths given
mkdir: no paths given
mkdir: no paths given
... 45 times
mkdir: no paths given
internal/streams/legacy.js:59
      throw er; // Unhandled stream error in pipe.
      ^

Error: ENOENT: no such file or directory, open '/mnt/dev/launcher/mc/libraries/com/mojang/patchy/1.1/patchy-1.1.jar'

Help pls

Unexpected Token.. Error Occurred


function launch() {
    const { Authenticator, Client} = require("minecraft-launcher-core");
const launcher = new Client();
const user = document.getElementById('username')
const pass = document.getElementById('password')

let opts = {
    overrides: {
        gameDirectory: "", // where the game process generates folders like saves and resource packs.
        minecraftJar: "",
        versionJson: "",
        directory: "", // where the Minecraft jar and version json are located.
        natives: "", // native directory path.
        assetRoot: "",
        libraryRoot: "",
        cwd: "", // working directory of the java process.
        detached: true, // whether or not the client is detached from the parent / launcher.
        classes: [], // all class paths are required if you use this.
        minArgs: 11, // The amount of launch arguments specified in the version file before it adds the default again
        maxSockets: 2, // max sockets for downloadAsync.
        // The following is for launcher developers located in countries that have the Minecraft and Forge resource servers
        // blocked for what ever reason. They obviously need to mirror the formatting of the original JSONs / file structures.
        url: {
            meta: "https://launchermeta.mojang.com", // List of versions.
            resource: "https://resources.download.minecraft.net", // Minecraft resources.
            mavenForge: "http://files.minecraftforge.net/maven/", // Forge resources.
            defaultRepoForge: "https://libraries.minecraft.net/", // for Forge only, you need to redefine the library url
                                                                 // in the version json.
            fallbackMaven: "https://search.maven.org/remotecontent?filepath="
        }
    }
 }

launcher.launch(opts)

launcher.on('debug', (e) => console.log(e));
launcher.on('data', (e) => console.log(e));
}

This IS My Code
Down Is The Error Code


Uncaught SyntaxError: Unexpected token ...
    at createScript (vm.js:74)
    at Object.runInThisContext (vm.js:116)
    at Module._compile (module.js:533)
    at Object.Module._extensions..js (module.js:580)
    at Module.load (module.js:503)
    at tryModuleLoad (module.js:466)
    at Function.Module._load (module.js:458)
    at Module.require (module.js:513)
    at require (internal/module.js:11)
    at Object.<anonymous> (C:\Users\Nishant\Downloads\Electron App\node_modules\minecraft-launcher-core\index.js:2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.