Minecraft - Launching game in Terminal and Command Prompt

Discussion in 'Computer Programming, Emulation, and Game Modding' started by SuperMarioDaBom, Nov 29, 2016.

  1. SuperMarioDaBom
    OP

    Newcomer SuperMarioDaBom Member

    Joined:
    Jun 6, 2016
    Messages:
    39
    Country:
    United States
    I've been working on a Minecraft server manager application in Unity3d (Yes, its in a game engine. I did that so that making it multi-platform would be extremely simple, and I am very familiar with the Unity api). I am implementing a function to launch Minecraft in-app, bypassing the official Minecraft launcher.

    I already implemented the Minecraft authentication api, so getting the access token is already handled. The one thing that is frustrating me is that I cannot get Minecraft to launch from terminal. Once that gets done, implementation into Unity will be a piece of cake.

    That being said, can someone give me the terminal command that will launch it? Obviously with the necessary place-holders. Thanks in advance. This has been frustrating me to no end, and Google doesn't seem to wanna help. All I could find were the old pre-yggdrasil commands.

    Thanks again.
     
    acro42 likes this.


  2. SuperMarioDaBom
    OP

    Newcomer SuperMarioDaBom Member

    Joined:
    Jun 6, 2016
    Messages:
    39
    Country:
    United States
    Is there anyone that can help? I feel kinda bad for bumping my own thread, but its been since November and not one single reply has been made. :mellow:
     
  3. Joom

    Member Joom  ❤❤❤

    Joined:
    Jan 8, 2016
    Messages:
    2,481
    Country:
    Antarctica
    java - jar minecraft.jar

    Of course, other parameters for Java can be passed, but this is the most basic way of loading it. Unless of course this doesn't work anymore. I haven't played the game in well over a year.
     
    Last edited by Joom, Jan 10, 2017
  4. SuperMarioDaBom
    OP

    Newcomer SuperMarioDaBom Member

    Joined:
    Jun 6, 2016
    Messages:
    39
    Country:
    United States
    That's the base of it, but it requires a whole ton of arguments to launch. Some of these are the Access Code, libraries, etc.

    Apparently the command is EXTREMELY long. I tried getting it from Minecraft's code, but it only gives "half" of it, which already is really long. When typing that half command in, it gives an error that it can't find a library - probably because it is not implemented into the code.
     
  5. UniqueGeek

    Member UniqueGeek PMD Researcher

    Joined:
    May 29, 2009
    Messages:
    1,441
    Country:
    United States
    If you're using Windows 8 or above, you can launch Minecraft, then use Task Manager to display all the command-line arguments Java was run with. It should be a simple matter to mimic that afterward.
    [​IMG]
     
    VinLark likes this.
  6. SuperMarioDaBom
    OP

    Newcomer SuperMarioDaBom Member

    Joined:
    Jun 6, 2016
    Messages:
    39
    Country:
    United States
    Ok, I appear to have found something useful! I used ProcessExplorer, as Task Manager wasn't giving the command in its entirety due to how long it is. Here it is:

    "C:\Program Files (x86)\Minecraft\runtime\jre-x64\1.8.0_25\bin\javaw.exe" -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M "-Dos.name=Windows 10" -Dos.version=10.0 "-Djava.library.path=C:\Users\<username>\AppData\Roaming\.minecraft\versions\1.8.9\1.8.9-natives-34757015043807" -cp "C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\mojang\netty\1.6\netty-1.6.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\17.0\guava-17.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.5.21\authlib-1.5.21.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\mojang\realms\1.7.59\realms-1.7.59.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-compress\1.8.1\commons-compress-1.8.1.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar;C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\6.5\twitch-6.5.jar;C:\Users\<username>\AppData\Roaming\.minecraft\versions\1.8.9\1.8.9.jar" net.minecraft.client.main.Main --username <gameuser> --version 1.8.9 --gameDir "C:\Users\<username>\AppData\Roaming\.minecraft" --assetsDir "C:\Users\<username>\AppData\Roaming\.minecraft\assets" --assetIndex 1.8 --uuid <uuid> --accessToken <accesstoken> --userProperties {} --userType legacy --nativeLauncherVersion 307

    Please note: <username> is your home folder. <gameuser> is your Minecraft username. <uuid> is your player's uuid. <accesstoken> is the accessToken (must be valid, otherwise will not work). This also is specific to Win10 I believe, so it might require editing for different versions. It is set to 1.8.9, but as seen above this can be pretty easily changed.

    I will soon be porting this to macOS and other Windows versions! Thanks @UniqueGeek for the lead! :D

    This was tested on Win10. It works perfectly just as long as the accessToken is valid! :P
     
  7. Joom

    Member Joom  ❤❤❤

    Joined:
    Jan 8, 2016
    Messages:
    2,481
    Country:
    Antarctica
    Why is all of that necessary? Shouldn't invoking the main JAR do all of that? I also noticed that it's using fixed memory allocations, which won't be ideal for all users.
     
    VinLark likes this.
  8. VinLark

    Member VinLark It's only man's fear that carries him on

    Joined:
    Jun 11, 2016
    Messages:
    3,051
    Location:
    Leonard Cohen ‎– Greatest Hits
    Country:
    United States
    What? How do you get this?

    And you are making a server manager? For Minecraft, with Unity? Maybe you could make a GUi for this in the future so you won't have to deal with command line
     
  9. SuperMarioDaBom
    OP

    Newcomer SuperMarioDaBom Member

    Joined:
    Jun 6, 2016
    Messages:
    39
    Country:
    United States
    It is necessary, in order for Minecraft to have access to all of the libraries and things that it needs. Also yes, it uses fixed memory allocations. Though it is customizable in the Minecraft Launcher.

    GUI for what? I don't understand what you mean.
     
  10. VinLark

    Member VinLark It's only man's fear that carries him on

    Joined:
    Jun 11, 2016
    Messages:
    3,051
    Location:
    Leonard Cohen ‎– Greatest Hits
    Country:
    United States
    GUI for the server manager.....

    oh forget it
     
  11. Sasori

    Member Sasori GBAtemp Maniac

    Joined:
    Jan 28, 2015
    Messages:
    1,173
    Country:
    United States
    He's referring to something such as Multicraft or mcmyadmin. They are full guis(big shiny clicky buttons) that do most tasks, instead of using terminal

    EDIT: For example here is the one that I use everyday for work. Do I get bonus points for the fancy editing?

    [​IMG]
     
    Last edited by Sasori, Jan 11, 2017
    VinLark likes this.
  12. Joom

    Member Joom  ❤❤❤

    Joined:
    Jan 8, 2016
    Messages:
    2,481
    Country:
    Antarctica
    When did this happen, or is it only pertinent for your manager to work? I used to invoke the JAR with a Bash script that was just a single line with memory allocations for my system. Maybe it's different on Windows. I don't really know. It'd be interesting to test your MacOS build when it's done.
     
    Last edited by Joom, Jan 11, 2017
  13. SuperMarioDaBom
    OP

    Newcomer SuperMarioDaBom Member

    Joined:
    Jun 6, 2016
    Messages:
    39
    Country:
    United States
    Ah, I see where that may have been confusing. The app I'm making will download and create the server for the specified version, then launch the corresponding version of Minecraft itself. It achieves this by authenticating through yggdrasil - Mojang's authentication servers. I hope this clears up any confusion.

    Lol 10/10 for best edits ever :P

    Its been that way ever since Minecraft switched launchers, I believe (2013?). I have only been playing Minecraft since its 1.8 release, so I'm not too well informed on how it worked before then. Don't expect anything very soon, though. I'm fairly busy irl and also tend to procrastinate on things. :P Since I now know someone wants a release, I shall put this towards the top of my priorities. :D
     
    Last edited by SuperMarioDaBom, Jan 11, 2017
  14. Joom

    Member Joom  ❤❤❤

    Joined:
    Jan 8, 2016
    Messages:
    2,481
    Country:
    Antarctica
    Ah, ok. I haven't really played since 1.5.2 or so, so that makes sense. Now I kinda want to try the latest build and see if I can figure out a simpler way to launch it. Honestly, it seems rather regressive to make that wall of text necessary, but I'm not a game developer, so what do I know?
     
  15. SuperMarioDaBom
    OP

    Newcomer SuperMarioDaBom Member

    Joined:
    Jun 6, 2016
    Messages:
    39
    Country:
    United States
    I don't think there is any easier way to launch it from command line, unfortunately. It needs all that info to launch. I think it also protects from piracy, so that it becomes a whole lot harder to implement ALL of those libraries, plus a valid accessToken. The harder it is, the less likely someone is gonna try and circumvent it.
     
  16. Joom

    Member Joom  ❤❤❤

    Joined:
    Jan 8, 2016
    Messages:
    2,481
    Country:
    Antarctica
    I suppose. I know of quite a few cracked launchers floating around that support the latest build, and this is due to the nature of Minecraft (which hasn't changed in the licensing department for quite a while). If they'd implement hardware ID licensing (say the ID of your hard drive or processor licenses the software) then it'd be much harder to crack, and wouldn't require legitimate customers and community developers to go through all these arduous tasks just to launch the game. But meh, I'm getting off-topic. I'll keep up for that Mac build and see if I can help in any way once it's done.
     
  17. UniqueGeek

    Member UniqueGeek PMD Researcher

    Joined:
    May 29, 2009
    Messages:
    1,441
    Country:
    United States
    Wait, you're making a server manager? You shouldn't need to deal with access tokens for servers.

    For a server, it should just be:
    Code:
    java -jar {minecraft server jar} -server -Xms{min memory}M -Xmx{max memory}M nogui
     
    Joom likes this.
  18. Joom

    Member Joom  ❤❤❤

    Joined:
    Jan 8, 2016
    Messages:
    2,481
    Country:
    Antarctica
    See, that's what I was thinking. I wonder if Unity is what's giving OP problems, but I really don't know much about this.
     
  19. UniqueGeek

    Member UniqueGeek PMD Researcher

    Joined:
    May 29, 2009
    Messages:
    1,441
    Country:
    United States
    I don't know much about Unity, but since it's C#, hopefully it has all the OP needs: System.Diagnostics.Process
     
  20. Joom

    Member Joom  ❤❤❤

    Joined:
    Jan 8, 2016
    Messages:
    2,481
    Country:
    Antarctica
    Wait, Unity is just C#? That makes it seem rather overly glorified, but I have a personal animosity against .NET languages.
     

Share This Page