Launch Minecraft from the command line Python/C++

2019-08-03 18:24发布

I have an issue where I am trying to use my previous knowledge of programming to write a Minecraft launcher. I have use of commands that are in the standard C++ libraries and any Python eggs that are not huge. I would prefer to use system("java ...") in order to launch Minecraft.

The question in short: How do I launch Minecraft from the command line without any auxillary Java code? (Without using launcher code like net.minecraft.LauncherFrame) Is it possible? I tried java -cp mine craft.jar net.minecraft.client.Minecraft from the Terminal in Mac OS X, to no avail, ending with a ClassNotFoundException.

Can anyone shed some light on my problem? Thank you, Pyro.

1条回答
相关推荐>>
2楼-- · 2019-08-03 18:51

I'm running on linux, but this also should work for you:

java -cp ".minecraft/bin/*" -Djava.library.path=".minecraft/bin/natives/" net.minecraft.client.Minecraft "username" "login id"

You don't need to input your username/login id, but if you don't, you can't get in any servers.

You can get your login id here: https://login.minecraft.net?user=<username>&password=<password>&version=13

More info about the authentication scheme here

UPDATE:
The new launcher for minecraft 1.6 changed a lot.
For the launch command you should look in .minecraft/versions/<version>/<version>.json The authentication also changed. It now uses POST parameters and returns JSON. More about it here.

查看更多
登录 后发表回答