command
command contains the function for creating the minecraft command
- get_minecraft_command(version: str, minecraft_directory: str | PathLike, options: MinecraftOptions) list[str]
Returns the command for running minecraft as list. The given command can be executed with subprocess. Use
get_minecraft_directory()to get the default Minecraft directory.- Parameters:
version (str) – The Minecraft version
minecraft_directory (str | PathLike) – The path to your Minecraft directory
options (MinecraftOptions) – Some Options (see below)
- Return type:
list[str]
optionsis a dict:options = { # This is needed "username": The Username, "uuid": uuid of the user, "token": the accessToken, # This is optional "executablePath": "java", # The path to the java executable "defaultExecutablePath": "java", # The path to the java executable if the client.json has none "jvmArguments": [], #The jvmArguments "launcherName": "minecraft-launcher-lib", # The name of your launcher "launcherVersion": "1.0", # The version of your launcher "gameDirectory": "/home/user/.minecraft", # The gameDirectory (default is the path given in arguments) "demo": False, # Run Minecraft in demo mode "customResolution": False, # Enable custom resolution "resolutionWidth": "854", # The resolution width "resolutionHeight": "480", # The resolution height "server": "example.com", # The IP of a server where Minecraft connect to after start "port": "123", # The port of a server where Minecraft connect to after start "nativesDirectory": "minecraft_directory/versions/version/natives", # The natives directory "enableLoggingConfig": False, # Enable use of the log4j configuration file "disableMultiplayer": False, # Disables the multiplayer "disableChat": False, # Disables the chat "quickPlayPath": None, # The Quick Play Path "quickPlaySingleplayer": None, # The Quick Play Singleplayer "quickPlayMultiplayer": None, # The Quick Play Multiplayer "quickPlayRealms": None, # The Quick Play Realms }
You can use the microsoft_account module to get the needed information. For more information about the options take a look at the More Launch Options tutorial.