Skip to content

ammarx/TagAPI_3

Repository files navigation

Open-source Minecraft Launcher API - TagAPI

The purpose of the API is to provide developers the ability to download / run Minecraft.

The accessible class which is the API_Interface, consists of the following functions:

  • Local Data:

    • List getInstallableVersionsList() - Returns list of all versions available to download
    • List getInstalledVersionsList() - Returns list of all versions installed on users machine
  • Screen Dimensions:

    • void setWidth(int WidthToUse) - Set screen size width for the game; default is 854
    • void setHeight(int HeightToUse) - Set screen size height for the game; default is 480
  • Memory Allocation:

    • void setMinMemory(int MemoryToUse) - Set amount of minimum memory allocated for the game; default is 1024
    • void setMemory(int MemoryToUse) - Set amount of maximum memory allocated for the game; default is 1024
  • Miscellaneous:

    • void syncVersions() - Syncs game profiles with premium launcher
    • void setJavaPath(String JavaPathToUse) - Set external Java path to use for the game; default path is JAVA path on the system
    • void setJVMArgument(String JVMArgumentsToUse) - Set extra JVM Arguments to use for the game; default arguments are none
    • void injectNetty(String OperatingSystemToUse) - Injects netty with invalid url. This can be used to bypass server blacklist
  • Server NBT:

    • List getServersIPList() - Returns the list of all IP addresses found in servers.dat
    • List getServersNameList() - Returns the list of all server names found in servers.dat
    • void addServerToServersDat(String NameOfTheServer, String IPAddress) - Adds the server name and IP to servers.dat using NBT uncompressed format
  • Downloads:

    • void downloadMinecraft(String VersionToUse, Boolean ForceDownload) - Accepts (Version to download, Force Download); if force download is True, it will re-download all the files, vice-versa if it is set to False, it will only download the missing files.
    • void downloadVersionManifest() - Downloads the list of all versions available on the server
    • void downloadProfile(String UsernameToUse) - Downloads the profile data in order to set UUID; Accepts (Username)
  • Launch:

    • void runMinecraft(String UsernameToUse, String VersionToUse) - Accepts (Username, Version to run) and launches Minecraft
  • Version Info:

    • String getAPIVersion() - Returns the version number of the API library
  • Logs:

    • String getLog() - Returns last logged log
    • List getLogs() - Returns a list of all logged logs
    • void dumpLogs() - Writes all logged logs to /.minecraft/Launcherlogs.txt
Key Log Type Purpose
[rl] {prefix} run logs tells when local file processing is being done
[dl] {prefix} download logs tells when API is downloading files
[el] {prefix} error logs tells when an error has occured in the API
[rl] Minecraft Corruption found! run logs tells when the API failed to run minecraft
[rl] Minecraft Initialized! run logs tells when the API has successfully run minecraft
[dl] Download Complete! download logs tells when the API has completed downloading files

Example Code

  • Download Minecraft (Force Download: False):
    tagapi_3.API_Interface API = new tagapi_3.API_Interface();
    API.downloadMinecraft("1.8.9", false); //download version 1.8.9, without replacing the files
  • Launch Minecraft:
    tagapi_3.API_Interface API = new tagapi_3.API_Interface();
    API.runMinecraft("Ammar_Ahmad", "1.8.9"); //run minecraft with username: Ammar_Ahmad, and version: 1.8.9