MiniDigger / MiniLauncher

MIT License
54 stars 10 forks source link

How does the launcher starts up the game? #13

Closed sourcelocation closed 1 year ago

sourcelocation commented 3 years ago

Hi, thanks for creating this awesome launcher. I am also making my own, but for MacOS. So I was thinking about how I would start up the Minecraft client. Then I found your project, but I cannot seem to find the place where the launcher runs the minecraft.jar in the source code of MiniLauncher. Could you please tell me where the launching process is located in your code? Thanks in advance!

MiniDigger commented 3 years ago

minilauncher uses a fork of jmccc located in /jmccc/ to do resolving of assets and launching of the game. in particular, starting is done here. https://github.com/MiniDigger/MiniLauncher/blob/master/JMCCC/jmccc/src/main/java/org/to2mbn/jmccc/launch/LauncherImpl.java

sourcelocation commented 3 years ago

Thanks for the reply! I sadly don't know Java language well, so I quite not understand what the code you've sent me. As far as I can tell, it generates the arguments and then launches the game with them. Do you know how the full arguments look like? And is it possible to execute that command from the terminal?

MiniDigger commented 3 years ago

"yes"

the arguments for the game are provided by mojang in the version manifest https://launchermeta.mojang.com/v1/packages/a57e1436e057febaadedca85f24aae7bf9418079/21w19a.json

just, you need to fill in all arguments properly, download the resources, etc. its a pain to do manually, which is why launchers exist :)

sourcelocation commented 3 years ago

Thank you. I just tried filling all the arguments, but I get Error: Could not find or load main class net.minecraft.client.Main. I think it could not load the libraries. I understand, that this is completely unrelated to your project, but I don't know anybody who can help me with this. This is what I have got so far: java -jar 1.12.2.jar --username Matthew --version 1.12.2 --gameDir "/Users/exerhythm/Library/Application\ Support/minecraft" --assetsDir /Users/exerhythm/Library/Application\ Support/minecraft/assets --versionType 1.12.2 -XstartOnFirstThread -Djava.library.path="/Users/exerhythm/Library/Application\ Support/minecraft/libraries" -Dminecraft.launcher.brand=Minecraft -Dminecraft.launcher.version=1 -cp net.minecraft.client.Main Again, thanks for helping me!

MiniDigger commented 3 years ago

check the manifest, mainclass is "net.minecraft.client.main.Main", but yes it will most likely horrible if you don't construct a proper class path

MiniDigger commented 3 years ago

this is what minilauncher generates, for windows

D:\Programms\jdk-11.0.3+7\bin\java.exe
-Xmx1024M
-Djava.library.path=D:\minilauncher\versions\1.16.4\1.16.4-natives
-Dminecraft.launcher.brand=Minilauncher
-Dminecraft.launcher.version=2.0
-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
-cp
D:\minilauncher\libraries\com\google\code\gson\gson\2.8.0\gson-2.8.0.jar;D:\minilauncher\libraries\com\google\guava\guava\21.0\guava-21.0.jar;D:\minilauncher\libraries\com\ibm\icu\icu4j\66.1\icu4j-66.1.jar;D:\minilauncher\libraries\com\mojang\authlib\2.0.27\authlib-2.0.27.jar;D:\minilauncher\libraries\com\mojang\brigadier\1.0.17\brigadier-1.0.17.jar;D:\minilauncher\libraries\com\mojang\datafixerupper\4.0.26\datafixerupper-4.0.26.jar;D:\minilauncher\libraries\com\mojang\javabridge\1.0.22\javabridge-1.0.22.jar;D:\minilauncher\libraries\com\mojang\patchy\1.1\patchy-1.1.jar;D:\minilauncher\libraries\com\mojang\text2speech\1.11.3\text2speech-1.11.3.jar;D:\minilauncher\libraries\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;D:\minilauncher\libraries\commons-io\commons-io\2.5\commons-io-2.5.jar;D:\minilauncher\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;D:\minilauncher\libraries\io\netty\netty-all\4.1.25.Final\netty-all-4.1.25.Final.jar;D:\minilauncher\libraries\it\unimi\dsi\fastutil\8.2.1\fastutil-8.2.1.jar;D:\minilauncher\libraries\net\java\dev\jna\jna\4.4.0\jna-4.4.0.jar;D:\minilauncher\libraries\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;D:\minilauncher\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;D:\minilauncher\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;D:\minilauncher\libraries\net\sf\jopt-simple\jopt-simple\5.0.3\jopt-simple-5.0.3.jar;D:\minilauncher\libraries\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;D:\minilauncher\libraries\org\apache\commons\commons-lang3\3.5\commons-lang3-3.5.jar;D:\minilauncher\libraries\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;D:\minilauncher\libraries\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;D:\minilauncher\libraries\org\apache\logging\log4j\log4j-api\2.8.1\log4j-api-2.8.1.jar;D:\minilauncher\libraries\org\apache\logging\log4j\log4j-core\2.8.1\log4j-core-2.8.1.jar;D:\minilauncher\libraries\org\lwjgl\lwjgl\3.2.2\lwjgl-3.2.2.jar;D:\minilauncher\libraries\org\lwjgl\lwjgl-glfw\3.2.2\lwjgl-glfw-3.2.2.jar;D:\minilauncher\libraries\org\lwjgl\lwjgl-jemalloc\3.2.2\lwjgl-jemalloc-3.2.2.jar;D:\minilauncher\libraries\org\lwjgl\lwjgl-openal\3.2.2\lwjgl-openal-3.2.2.jar;D:\minilauncher\libraries\org\lwjgl\lwjgl-opengl\3.2.2\lwjgl-opengl-3.2.2.jar;D:\minilauncher\libraries\org\lwjgl\lwjgl-stb\3.2.2\lwjgl-stb-3.2.2.jar;D:\minilauncher\libraries\org\lwjgl\lwjgl-tinyfd\3.2.2\lwjgl-tinyfd-3.2.2.jar;D:\minilauncher\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar;D:\minilauncher\versions\1.16.4\1.16.4.jar
net.minecraft.client.main.Main
--username
Test
--version
1.16.4/Test
--gameDir
D:\minilauncher
--assetsDir
D:\minilauncher\assets
--assetIndex
1.16
--uuid
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--accessToken
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--userType
mojang
--versionType
release