Last active
January 24, 2016 19:52
-
-
Save bakatrouble/af018490a5e47ede63ff to your computer and use it in GitHub Desktop.
Vanilla Minecraft runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from subprocess import Popen | |
from os import path | |
from platform import system | |
from uuid import uuid4 | |
def run_game(game_path, game_data, main_class, version, uuid=str(uuid4()), xmx=1024, max_perm_size=128, more=list()): | |
""" | |
:type game_path: str | |
:type game_data: str | |
:type main_class: str | |
:type version: str | |
:type uuid: str | |
:type xmx: int | |
:type max_perm_size: int | |
:type more: list | |
""" | |
path_delimiter = ";" if system() == "Windows" else ":" | |
args = [ | |
"java", | |
"-XX:+UseConcMarkSweepGC", | |
"-XX:+CMSIncrementalMode", | |
"-XX:-UseAdaptiveSizePolicy", | |
"-Xmn128M", | |
"-Djava.library.path=" + path.join(game_path, "natives"), | |
"-cp", | |
path.join(game_path, "libs", "*") + path_delimiter + path.join(game_path, "minecraft.jar"), | |
main_class, | |
"--version", version, | |
"--gameDir", game_data, | |
"--assetsDir", path.join(game_path, "assets"), | |
"--assetIndex", version, | |
"--userProperties", "{}", | |
"--accessToken", "123456", | |
"--uuid", uuid, | |
"-Xms" + str(xmx) + "M", | |
"-Xmx" + str(xmx) + "M", | |
"-XX:MaxPermSize=" + str(max_perm_size) + "M", | |
"-Dfml.ignorePatchDiscrepancies=true" | |
] + more | |
pid = Popen(args).pid | |
return pid | |
if __name__ == '__main__': | |
run_game(game_path="game", game_data="gamedata", main_class="net.minecraft.client.main.Main", | |
version="1.7.10", xmx=1024) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment