MultiMC / Launcher

A custom launcher for Minecraft that allows you to easily manage multiple installations of Minecraft at once
https://multimc.org/
Other
4.32k stars 884 forks source link

add "use native system versions of lwjgl" option #3698

Closed rhjdvsgsgks closed 3 years ago

rhjdvsgsgks commented 3 years ago

Role

i play Minecraft with system which provided newer version of lwjgl

Suggestion

add option to use native system versions of lwjgl, just like 5180536

Benefit

so that i can use newer version of lwjgl and update it by system package manager

This suggestion is unique

phit commented 3 years ago

lwjgl is a game library, that is bundled with games, what OS ships it with its system package manager? how does that work with multiple versions? minecraft needs very specific versions to work, I don't see how this would ever work out

rhjdvsgsgks commented 3 years ago

i'm using archlinux, aur provided it (lwjgl and lwjgl2) , and i tried play Minecraft 1.16.5 with lwjgl 3.2.3 which newer than official provided version, and it works.

OT7EtoYoshimura commented 3 years ago

Thought of suggesting this when I tried running multimc for the first time, without Internet and it crashed since it tries to pull lwjgl from Mojang(ig?) but apparently someone had beat me to it by a few days. Thumbs up

ByJumperX4 commented 3 years ago

I don't see a use to it, plus you would need both lwjgl 2 and 3 because versions prior to 1.13 of minecraft won't run with lwjgl 3.x, as an optional thing, it may be useful to some people, but it clearly shouldn't be the default

shinji257 commented 3 years ago

Minecraft used to ship with some pretty old libraries and MultiMC have always tried to use the newest compatible versions. Currently MultiMC is using 3.2.2 for 1.16.5 and 2.9.4 on 1.12.2 from what I checked. The version can be changed per instance but if there is a newer version available than what is showing maybe we should wait until it shows up as an option so we know we are getting a properly built set of libraries that works well with Minecraft.

With that said there could be an option to use native system LWJGL 2 and 3. At that point it would be up to the user to ensure it is actually available and compatible.

@phit This isn't necessarily true as there is an old Minecraft wiki page that specifically showed how to update lwjgl on vanilla versions of Minecraft to fix some bugs people may encounter. This is 1.12.2 and older but still applies with newer versions. https://minecraft.fandom.com/wiki/Tutorials/Update_LWJGL_(Legacy)

rhjdvsgsgks commented 3 years ago

i found a temporary solution: in instance - version - lwjgl - customize - edit , paste this in (just remove downnload link and change version)

{
    "formatVersion": 1,
    "libraries": [
        {
            "name": "org.lwjgl:lwjgl-glfw:0"
        },
        {
            "name": "org.lwjgl:lwjgl-glfw:0",
            "natives": {
                "linux": "natives-linux",
                "osx": "natives-macos",
                "windows": "natives-windows"
            }
        },
        {
            "name": "org.lwjgl:lwjgl-jemalloc:0"
        },
        {
            "name": "org.lwjgl:lwjgl-jemalloc:0",
            "natives": {
                "linux": "natives-linux",
                "osx": "natives-macos",
                "windows": "natives-windows"
            }
        },
        {
            "name": "org.lwjgl:lwjgl-openal:0"
        },
        {
            "name": "org.lwjgl:lwjgl-openal:0",
            "natives": {
                "linux": "natives-linux",
                "osx": "natives-macos",
                "windows": "natives-windows"
            }
        },
        {
            "name": "org.lwjgl:lwjgl-opengl:0"
        },
        {
            "name": "org.lwjgl:lwjgl-opengl:0",
            "natives": {
                "linux": "natives-linux",
                "osx": "natives-macos",
                "windows": "natives-windows"
            }
        },
        {
            "name": "org.lwjgl:lwjgl-stb:0"
        },
        {
            "name": "org.lwjgl:lwjgl-stb:0",
            "natives": {
                "linux": "natives-linux",
                "osx": "natives-macos",
                "windows": "natives-windows"
            }
        },
        {
            "name": "org.lwjgl:lwjgl-tinyfd:0"
        },
        {
            "name": "org.lwjgl:lwjgl-tinyfd:0",
            "natives": {
                "linux": "natives-linux",
                "osx": "natives-macos",
                "windows": "natives-windows"
            }
        },
        {
            "name": "org.lwjgl:lwjgl:0"
        },
        {
            "name": "org.lwjgl:lwjgl:0",
            "natives": {
                "linux": "natives-linux",
                "osx": "natives-macos",
                "windows": "natives-windows"
            }
        }
    ],
    "name": "LWJGL 3",
    "releaseTime": "",
    "type": "release",
    "uid": "org.lwjgl3",
    "version": "0",
    "volatile": false
}

open multimc/libraries/org/lwjgl folder, create a sh file, paste and execute it (or simply execute it in shell)

ver=0
for i in lwjgl*
do
        mkdir $i/$ver
        ln -s /usr/share/lwjgl/$i/$i.jar $i/$ver/$i-$ver.jar
        if [ -e /usr/share/lwjgl/$i/$i-natives-linux.jar ]
        then
                ln -s /usr/share/lwjgl/$i/$i-natives-linux.jar $i/$ver/$i-$ver-natives-linux.jar
        fi
done

edit: support new format in lwjgl 3.3.1

{
    "formatVersion": 1,
    "libraries": [
        {
            "name": "org.lwjgl:lwjgl-glfw-natives-linux:0"
        },
        {
            "name": "org.lwjgl:lwjgl-glfw:0"
        },
        {
            "name": "org.lwjgl:lwjgl-jemalloc-natives-linux:0"
        },
        {
            "name": "org.lwjgl:lwjgl-jemalloc:0"
        },
        {
            "name": "org.lwjgl:lwjgl-openal-natives-linux:0"
        },
        {
            "name": "org.lwjgl:lwjgl-openal:0"
        },
        {
            "name": "org.lwjgl:lwjgl-opengl-natives-linux:0"
        },
        {
            "name": "org.lwjgl:lwjgl-opengl:0"
        },
        {
            "name": "org.lwjgl:lwjgl-stb-natives-linux:0"
        },
        {
            "name": "org.lwjgl:lwjgl-stb:0"
        },
        {
            "name": "org.lwjgl:lwjgl-tinyfd-natives-linux:0"
        },
        {
            "name": "org.lwjgl:lwjgl-tinyfd:0"
        },
        {
            "name": "org.lwjgl:lwjgl-natives-linux:0"
        },
        {
            "name": "org.lwjgl:lwjgl:0"
        }
    ],
    "name": "LWJGL 3",
    "releaseTime": "",
    "type": "release",
    "uid": "org.lwjgl3",
    "version": "0",
    "volatile": false
}
ver=0
flavor=natives-linux
for i in lwjgl*
do
    mkdir -p $i/$ver
    # not overwrite, otherwise when i = lwjgl-glfw-natives-linux, target will been overwrite poient to /usr/share/lwjgl/lwjgl-glfw-natives-linux/lwjgl-glfw-natives-linux.jar, which should be /usr/share/lwjgl/lwjgl-glfw/lwjgl-glfw-natives-linux.jar
    ln -s /usr/share/lwjgl/$i/$i.jar $i/$ver/$i-$ver.jar
    if [ -e /usr/share/lwjgl/$i/$i-$flavor.jar ]
    then
        ln -s /usr/share/lwjgl/$i/$i-$flavor.jar $i/$ver/$i-$ver-$flavor.jar
        # when first time i = lwjgl-glfw , lwjgl-glfw-natives-linux/0 may not exist
        # not working and unecessary when $i-$flavor not exist
        mkdir $i-$flavor/$ver
        # force link to correct path /usr/share/lwjgl/lwjgl-glfw/lwjgl-glfw-natives-linux.jar
        # not working and unecessary when $i-$flavor not exist
        ln -sf /usr/share/lwjgl/$i/$i-$flavor.jar $i-$flavor/$ver/$i-$flavor-$ver.jar
    fi
done
kb-1000 commented 3 years ago

Given that MultiMC cares about using correct/properly compatible with Minecraft versions of LWJGL, I don't see this ever getting added. Supporting system GLFW/OpenAL actually makes sense, since custom versions of those can contain system integration/compatibility improvements, larger feature sets or similar, and are also commonly distributed in Linux distro repos. LWJGL is simply a Java binding for those two and a few other libraries... and LWJGL 3 doesn't even warrant API/ABI compatibility between versions, which is why it's important to use the right version.