Launch Minecraft from the command line Python/C++

我的未来我决定 提交于 2020-01-11 10:29:07

问题


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:


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.



来源:https://stackoverflow.com/questions/14617990/launch-minecraft-from-the-command-line-python-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!