tomsik68 / mclauncher-api

Tomsik68's Minecraft Launcher API. Documenting how minecraft launcher works & creating an API which will be able to work with custom launchers. Make sure to check out wiki!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need help with installing

JakobDev opened this issue · comments

I'm writing a launcher in Python but I need help with installing Minecraft. I had now made this code. I have put it into a format that works without the rest od the launcher. Can you please look over it and say me what is missing?

Judging by looking at the code, I think you're missing rules for libraries and downloading native libraries. However, you should really finish the code for running Minecraft and test it for yourself as there's a great chance I missed something 😄

Just a example for native libraries:

{
      "name": "org.lwjgl:lwjgl:3.2.1",
      "natives": {
        "linux": "natives-linux",
        "osx": "natives-macos",
        "windows": "natives-windows"
      },
      "downloads": {
        "artifact": {
          "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1.jar",
          "sha1": "2bb514e444994c6fece99a21f76e0c90438e377f",
          "size": 317748
        },
        "classifiers": {
          "javadoc": {
            "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-javadoc.jar",
            "sha1": "1f6b7050737559b775d797c0ea56612b8e373fd6",
            "size": 1287174
          },
          "natives-linux": {
            "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-natives-linux.jar",
            "sha1": "9bdd47cd63ce102cec837a396c8ded597cb75a66",
            "size": 87484
          },
          "natives-macos": {
            "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-natives-macos.jar",
            "sha1": "5a4c271d150906858d475603dcb9479453c60555",
            "size": 39835
          },
          "natives-windows": {
            "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-natives-windows.jar",
            "sha1": "e799d06b8969db0610e68776e0eff4b6191098bd",
            "size": 255871
          },
          "sources": {
            "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-sources.jar",
            "sha1": "106f90ac41449004a969309488aa6e3a2f7d6731",
            "size": 255671
          }
        }

Should I download as Linux User lwjgl-3.2.1-natives-linux.jar here? And whats with lwjgl-3.2.1.jar from artifact?

btw:
How can I get the run command? There are different formats in different versions.json.

Should I download as Linux User lwjgl-3.2.1-natives-linux.jar here? And whats with lwjgl-3.2.1.jar from artifact?

You should download both jars. The one with natives is supposed to be extracted later to a folder that is passed as a CLI argument to the JVM that will start Minecraft.

How can I get the run command? There are different formats in different versions.json.

Sadly, you need to understand both formats.

The native jar should be named lwjgl-3.2.1-natives-linux.jar and the artifact should be named lwjgl-3.2.1.jar? Are there only those two formats?

The artifact should be named lwjgl-3.2.1.jar and naming of the natives jar is not important.

Sorry for keep asking you, but I#M currently working at a script to run MC, and I have a few questions: Is ist possible to run Minecraft with wrong access token in offline mode (I have currently no login),? "here do I get the natives directory? And are the class paths just the path to the download libraries and the main class?

Is ist possible to run Minecraft with wrong access token in offline mode (I have currently no login),?

I think it is, but you have to test it for yourself.


"here do I get the natives directory?

Could you, please, rephrase this question? I don't understand.


And are the class paths just the path to the download libraries and the main class?

Classpath needs to include all libraries that are not disallowed by rules for your platform, plus the client jar.

I need to know where I get the path for ${natives_directory}

There are no requirements for the location by the game, you could just use a temporary directory. For example, official minecraft launcher uses .minecraft/versions/1.12/natives-${timestamp}.
The only important thing is to extract all required natives to that directory.

Where are the natives that I must put in that directory?

For every library allowed by rules, that contains natives key, you need to extract a jar with the natives.

Suppose a library contains the following information:

      "natives": {
        "linux": "natives-linux",
        "osx": "natives-macos",
        "windows": "natives-windows"
      },
      "downloads": {
        "artifact": {
          "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1.jar",
          "sha1": "2bb514e444994c6fece99a21f76e0c90438e377f",
          "size": 317748
        },
        "classifiers": {
          "javadoc": {
            "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-javadoc.jar",
            "sha1": "1f6b7050737559b775d797c0ea56612b8e373fd6",
            "size": 1287174
          },
          "natives-linux": {
            "url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-natives-linux.jar",
            "sha1": "9bdd47cd63ce102cec837a396c8ded597cb75a66",
            "size": 87484
          },

You need to first see if natives key exists. Then, lookup linux in the natives section. You get natives-linux. That is name of the classifier of the artifact -- the jar to be extracted. You can use it to lookup the right artifact in classifiers section of the library. If you do that correctly, you should end up with this URL: https://libraries.minecraft.net/org/lwjgl/lwjgl/3.2.1/lwjgl-3.2.1-natives-linux.jar. Download it (to any directory) and make sure that before launching, you extract files from it (you can use the same library as for zip files).

Just for testing reasons: Where does the original Minecraft Launcher saves the native libraries when Minecraft doesn't run?

I believe the natives directory only exists while Minecraft is running when using the original launcher.
As I said previously, it can be found in .minecraft/versions/1.12/natives-${timestamp}.

I'm closing the issue now. Please open another one if you need help or join the gitter room to chat in real-time which might be better if you have a general question like this one 😄