Pierce01 / MinecraftLauncher-core

Lightweight module that downloads and runs Minecraft using javascript / NodeJS
MIT License
359 stars 82 forks source link

MacOS(11.3) - Failed to load minecraft main class #70

Closed LittleSheep2Code closed 3 years ago

LittleSheep2Code commented 3 years ago

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!

Pierce01 commented 3 years ago

Huh, weird. Are you able to start from a root folder that has no files in it?

LittleSheep2Code commented 3 years ago

I am sure there many file in minecraft folder image

LittleSheep2Code commented 3 years ago

If I boot from a new folder, the script will auto download some things

Pierce01 commented 3 years ago

Wait, are all the natives still jar files? they should be extracted, will look into this when I can. I currently do not have a MacOS set up, so unsure when I'll be able to help.

LittleSheep2Code commented 3 years ago

After I add os: "osx", I forgot I need remove minecraft folder and download it again. Now this bug is be fixed. The jar is extarcted! image

But I found a new question. The script cannot load the minecraft main class

Error: Cannot find or load the main class net.minecraft.client.main.Main
Reason: java.lang.ClassNotFoundException: net.minecraft.client.main.Main
LittleSheep2Code commented 3 years ago

I remove the 1.14.jar and retry many time. It work! I think it is network question. I am Chinese Or this is a probability problem?

Pierce01 commented 3 years ago

If you are currently in China, there will be issues downloading Minecraft from the proper file endpoints. You'll need to use a mirror server.