-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,842 changed files
with
263,073 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.UnsupportedEncodingException; | ||
import java.lang.reflect.Field; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
import java.net.URLEncoder; | ||
|
||
import net.minecraft.client.Minecraft; | ||
|
||
public class Start | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
try | ||
{ | ||
Field f = Minecraft.class.getDeclaredField("minecraftDir"); | ||
Field.setAccessible(new Field[] { f }, true); | ||
f.set(null, new File(".")); | ||
} | ||
catch (Exception e) | ||
{ | ||
e.printStackTrace(); | ||
return; | ||
} | ||
|
||
if (args.length != 2) | ||
{ | ||
Minecraft.main(args); | ||
} | ||
else | ||
{ | ||
try | ||
{ | ||
String parameters = "http://login.minecraft.net/?user=" + URLEncoder.encode(args[0], "UTF-8") + | ||
"&password=" + URLEncoder.encode(args[1], "UTF-8") + | ||
"&version=" + 13; | ||
String result = openUrl(parameters); | ||
|
||
if (result == null) | ||
{ | ||
System.out.println("Can't connect to minecraft.net"); | ||
return; | ||
} | ||
|
||
if (!result.contains(":")) | ||
{ | ||
System.out.println("Login Failed: " + result); | ||
return; | ||
} | ||
|
||
String[] values = result.split(":"); | ||
Minecraft.main(new String[] {values[2].trim(), values[3].trim()}); | ||
} | ||
catch (Exception e) | ||
{ | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
|
||
private static String openUrl(String addr) | ||
{ | ||
try | ||
{ | ||
URL url = new URL(addr); | ||
java.io.InputStream is; | ||
is = url.openConnection().getInputStream(); | ||
java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(is)); | ||
String buf = ""; | ||
String line = null; | ||
|
||
while ((line = reader.readLine()) != null) | ||
{ | ||
buf += "\n" + line; | ||
} | ||
|
||
reader.close(); | ||
return buf; | ||
} | ||
catch (IOException e) | ||
{ | ||
e.printStackTrace(); | ||
} | ||
|
||
return null; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/minecraft/cpw/mods/fml/client/CustomModLoadingErrorDisplayException.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package cpw.mods.fml.client; | ||
|
||
import net.minecraft.client.gui.FontRenderer; | ||
import net.minecraft.client.gui.GuiErrorScreen; | ||
import cpw.mods.fml.common.IFMLHandledException; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
|
||
/** | ||
* If a mod throws this exception during loading, it will be called back to render | ||
* the error screen through the methods below. This error will not be cleared, and will | ||
* not allow the game to carry on, but might be useful if your mod wishes to report | ||
* a fatal configuration error in a pretty way. | ||
* | ||
* Throw this through a proxy. It won't work on the dedicated server environment. | ||
* @author cpw | ||
* | ||
*/ | ||
@SideOnly(Side.CLIENT) | ||
public abstract class CustomModLoadingErrorDisplayException extends RuntimeException implements IFMLHandledException | ||
{ | ||
/** | ||
* Called after the GUI is inited by the parent code. You can do extra stuff here, maybe? | ||
* | ||
* @param errorScreen The error screen we're painting | ||
* @param fontRenderer A font renderer for you | ||
*/ | ||
public abstract void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer); | ||
|
||
/** | ||
* Draw your error to the screen. | ||
* | ||
* <br/><em>Warning: Minecraft is in a deep error state.</em> <strong>All</strong> it can do is stop. | ||
* Do not try and do anything involving complex user interaction here. | ||
* | ||
* @param errorScreen The error screen to draw to | ||
* @param fontRenderer A font renderer for you | ||
* @param mouseRelX Mouse X | ||
* @param mouseRelY Mouse Y | ||
* @param tickTime tick time | ||
*/ | ||
public abstract void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime); | ||
} |
Oops, something went wrong.