1

I'm currently working on a custom Minecraft 1.6.4 launcher. I have written most of the code is C# however I'm writing the final piece of code in batch.

This seems to work to launch the minecraft 1.5.2 jar

cd "%~1"
java -Xms512m -Xmx1g -Djava.library.path=Bin\bin\native\ -cp Bin\bin\* net.minecraft.client.Minecraft %~2 %~3
pause

(C# Works out the session ID (%~3))

However in minecraft 1.6.4 I get an error:

Error: Could not find or load main class net.minecraft.client.Minecraft

I have heard about a change in the way Minecraft launches, is there anyway for me to implement the new system into my launcher?

If there is a way to do it without batch that would be awesome!

C# code to launch the batch file:

string sessionID = Session.DoLogin(tbUser.Text, tbPassword.Text).SessionId;
Process p = Process.Start("launch.bat", @"""" + filePath + @"""" + " " + tbUser.Text + " " + sessionID);
p.WaitForExit();
LAK132
  • 93
  • 1
  • 9
  • Do your batch commands work successfully *outside* of the batch file, at a command prompt? – Robert Harvey Dec 10 '13 at 05:36
  • No, that is the primary problem – LAK132 Dec 10 '13 at 05:39
  • So this comes down to "how do you launch Minecraft?" Have you ever done it successfully? – Robert Harvey Dec 10 '13 at 05:39
  • Yes, as stated. But the 1.6.4+ update breaks the code. I have look almost EVERY WHERE and cannot find any information on launching 1.6.4 from the command prompt. Another thing to note, I'm attempting to bypass the default Minecraft launcher – LAK132 Dec 10 '13 at 05:43
  • Try to specify [working directory](http://stackoverflow.com/a/20393336/1997232). – Sinatr Dec 10 '13 at 06:43
  • I believe I have found the problem. 1.6+ requires 3 extra parameters when launching. It needs the assets and game directories as well as the version number – LAK132 Dec 10 '13 at 08:34

2 Answers2

3

I was the first to make a C# launcher for minecraft and I'm happy to share some experiences. I'm sorry to reply to you so late!

Note that you are looking to start the class "net.minecraft.client.main.Main" instead of "net.minecraft.client.Minecraft". I came across this as well when I had to port my launcher to 1.6. It still works for 1.7.4 currently.

The example below is a cleaned up batch command straight from my (EDIT: OLD, but gold) open source launcher


Minecraft 1.7.4 batch launch (jvm arguments):

java 
-Djava.library.path=C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.0\ 
-cp 
C:\Users\<username>\AppData\Roaming\.minecraft\versions\1.7.4\1.7.4.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\java3d\vecmath\1.3.1\vecmath-1.3.1.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.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.5\jopt-simple-4.5.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.10.Final\netty-all-4.0.10.Final.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\15.0\guava-15.0.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.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\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.2\authlib-1.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.1-nightly-20131120\lwjgl-2.9.1-nightly-20131120.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.1-nightly-20131120\lwjgl_util-2.9.1-nightly-20131120.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.1-nightly-20131120\lwjgl-platform-2.9.1-nightly-20131120-natives-windows.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\5.12\twitch-5.12.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch-platform\5.12\twitch-platform-5.12-natives-windows-64.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch-external-platform\4.5\twitch-external-platform-4.5-natives-windows-64.jar;
net.minecraft.client.main.Main  
--username=<your username> 
--accessToken <your accesstoken> 
--version 1.7.4 
--gameDir C:\Users\<username>\AppData\Roaming\.minecraft 
--assetsDir C:\Users\<username>\AppData\Roaming\.minecraft\assets  
--userProperties {} 
--uuid <your uuid>

You can also find out how to get the uuid, session token, and so on on in the same namespace in the link above , or HERE.

Grease
  • 1,228
  • 11
  • 12
1

This might help: http://s3.amazonaws.com/Minecraft.Download/versions/1.6.4/1.6.4.json

The link format works for all minecraft versions so you can compare the information and check what has changed.

Be also aware that the Minecraft authentication system has changed. (I think you have to use the new system since 1.7 but it might apply for 1.6 too)

Edit: You also might want to decompile the official launcher (I did that for my own launcher) provides some useful information about how stuff works.

JensV
  • 3,481
  • 1
  • 18
  • 36