Skip to content

Commit

Permalink
Add 1.4.7 source
Browse files Browse the repository at this point in the history
  • Loading branch information
xJon committed Apr 2, 2023
1 parent 5079490 commit 558772a
Show file tree
Hide file tree
Showing 1,842 changed files with 263,073 additions and 0 deletions.
88 changes: 88 additions & 0 deletions src/minecraft/Start.java
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;
}
}
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);
}
Loading

0 comments on commit 558772a

Please sign in to comment.