Skip to content

Commit

Permalink
d
Browse files Browse the repository at this point in the history
Signed-off-by: deathrat <[email protected]>
  • Loading branch information
zach-hill committed Dec 8, 2011
1 parent 56bf56b commit be891fe
Show file tree
Hide file tree
Showing 22 changed files with 175 additions and 40 deletions.
1 change: 1 addition & 0 deletions favorites.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
66 changes: 66 additions & 0 deletions libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
jinput:
current:
recommended: 2.6
latest: 2.8.2
versions:
2.8.2: d62ff8cd9539a32dac094c00e820e9e6
2.8.1: d62ff8cd9539a32dac094c00e820e9e6
2.6: a7835a73a130656aba23e34147a55367
lwjgl:
current:
recommended: 2.6
latest: 2.8.2
versions:
2.8.2: 31b91cb8a5c32e026201dc06fe28d833
2.8.1: fe4e4f457d5fc88d904cf91962ae9adf
2.6: 7a07c4285fa9a6b204ba59f011f1cd77
lwjgl_util:
current:
recommended: 2.6
latest: 2.8.2
versions:
2.8.2: 120dbb06ce1818f3cd2501c8e25180ec
2.8.1: ec0f6be5aa2000ec96867fa84a1d205b
2.6: f00470751cfc093ba760ca3cf10a512c
commons-io:
current:
recommended: 2.1
latest: 2.1
versions:
2.1: 4854c2344aa182ad4f37976e83348aa0
commons-lang3:
current:
recommended: 3.1
latest: 3.1
versions:
3.1: 71b48e6b3e1b1dc73fe705604b9c7584
guava:
current:
recommended: 10.0.1
latest: 10.0.1
versions:
10.0.1: d05cd8b0a7ee4466994d64779eb28190
joda-time:
current:
recommended: 2.0
latest: 2.0
versions:
2.0: 8b6290a9834be663fef9c21adeb8cf5e
slick:
current:
recommended: 3.0
latest: 3.0
versions:
3.0: 79d2d31fb11eeff8600a3eef6ca5a8ab
snakeyaml:
current:
recommended: 1.9
latest: 1.9
versions:
1.9: aee7d6eb28be4b13a207cb6dc565a7db
trove4j:
current:
recommended: 3.0.1
latest: 3.0.1
versions:
3.0.1: ae6d695605990bd2544b358f17b11c28
9 changes: 9 additions & 0 deletions minecraft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
current:
recommended: 1.0.0
latest: 1.0.0
versions:
1.0.0:
jinput: a7835a73a130656aba23e34147a55367
lwjgl: 7a07c4285fa9a6b204ba59f011f1cd77
lwjgl_util: f00470751cfc093ba760ca3cf10a512c
minecraft: 3820d222b95d0b8c520d9596a756a6e6
2 changes: 2 additions & 0 deletions mirrors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mirrors:
urcraft.com: 75
15 changes: 15 additions & 0 deletions spoutcraft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
launcher: 001
current: 001
recommended: 001
latest: 001
builds:
001:
minecraft: 1.0.0
libraries:
commons-io: 2.1
commons-lang3: 3.1
guava: 10.0.1
joda-time: 2.0
slick: 0.3
snakeyaml: 1.9
trove4j: 3.0.1
39 changes: 31 additions & 8 deletions src/main/java/org/spoutcraft/launcher/GameUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.jar.JarOutputStream;
import java.util.jar.Pack200;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;

Expand All @@ -59,7 +60,7 @@ public class GameUpdater implements DownloadListener {
public static final File binCacheDir = new File(binDir, "cache");
public static final File updateDir = new File(PlatformUtils.getWorkingDirectory(), "temp");
public static final File backupDir = new File(PlatformUtils.getWorkingDirectory(), "backups");
public static final File spoutcraftDir = new File(PlatformUtils.getWorkingDirectory(), "spoutcraft");
public static final File spoutcraftDir = new File(PlatformUtils.getWorkingDirectory(), "technic");
public static final File savesDir = new File(PlatformUtils.getWorkingDirectory(), "saves");

/* Minecraft Updating Arguments */
Expand Down Expand Up @@ -263,20 +264,42 @@ public void updateSpoutcraft() throws Exception {
copy(mcCache, updateMC);
}

File spoutcraft = new File(GameUpdater.updateDir, "spoutcraft.jar");
File spoutcraft = new File(GameUpdater.updateDir, "technic.jar");
File techniczip = new File(GameUpdater.updateDir, "technic.zip");

stateChanged("Looking Up Mirrors...", 0F);
build.setDownloadListener(this);

String url = build.getSpoutcraftURL();
String url2 = build.getTechnicZipURL();

if (url == null) {
throw new NoMirrorsAvailableException();
}

if (url2 == null) {
throw new NoMirrorsAvailableException();
}

Download download = DownloadUtils.downloadFile(url, spoutcraft.getPath(), null, null, this);
if (download.isSuccess()) {
copy(download.getOutFile(), new File(binDir, "spoutcraft.jar"));
copy(download.getOutFile(), new File(binDir, "technic.jar"));
}

Download download2 = DownloadUtils.downloadFile(url2, techniczip.getPath(), null, null, this);
if(download2.isSuccess()){
// copy(download2.getOutFile(), new File(PlatformUtils.getWorkingDirectory(), "technic.zip"));
stateChanged("Extracting Files...", 0);
// try {
// extractZip(PlatformUtils.getWorkingDirectory(), new File(GameUpdater.updateDir.getPath() + File.separator + "technic.zip"));
// }
// catch (FileNotFoundException inUse) {
// //If we previously loaded this dll with a failed launch, we will be unable to access the files
// //This is because the previous classloader opened them with the parent classloader, and while the mc classloader
// //has been gc'd, the parent classloader is still around, holding the file open. In that case, we have to assume
// //the files are good, since they got loaded last time...
// }
// extractZip(PlatformUtils.getWorkingDirectory(), new File(GameUpdater.updateDir.getPath() + File.separator + "technic.zip"));
}

File libDir = new File(binDir, "lib");
Expand All @@ -301,7 +324,7 @@ public void updateSpoutcraft() throws Exception {

if (!libraryFile.exists()) {
String mirrorURL = "/Libraries/" + lib.getKey() + "/" + name + ".jar";
String fallbackURL = "http://mirror3.getspout.org/Libraries/" + lib.getKey() + "/" + name + ".jar";
String fallbackURL = "http://urcraft.com/technic/Libraries/" + lib.getKey() + "/" + name + ".jar";
url = MirrorUtils.getMirrorUrl(mirrorURL, fallbackURL, this);
download = DownloadUtils.downloadFile(url, libraryFile.getPath(), lib.getKey() + ".jar", MD5, this);
}
Expand All @@ -310,7 +333,7 @@ public void updateSpoutcraft() throws Exception {
build.install();

//TODO: remove this once this build has been out for a few weeks
File spoutcraftVersion = new File(GameUpdater.spoutcraftDir, "versionSpoutcraft");
File spoutcraftVersion = new File(GameUpdater.spoutcraftDir, "versionTechnic");
spoutcraftVersion.delete();
}

Expand All @@ -325,7 +348,7 @@ public boolean isSpoutcraftUpdateAvailable() throws IOException {
if (build.getBuild() != build.getInstalledBuild())
return true;

File spoutcraft = new File(binDir, "spoutcraft.jar");
File spoutcraft = new File(binDir, "technic.jar");
if (!spoutcraft.exists())
return true;

Expand Down Expand Up @@ -462,7 +485,7 @@ public void addFilesToExistingZip(File zipFile, Set<ClassFile> files, String roo

progress += progressStep;
if (progressBar) {
stateChanged("Merging Spoutcraft Files Into Minecraft Jar...", progress);
stateChanged("Merging Technic Files Into Minecraft Jar...", progress);
}
}
zin.close();
Expand All @@ -482,7 +505,7 @@ public void addFilesToExistingZip(File zipFile, Set<ClassFile> files, String roo

progress += progressStep;
if (progressBar) {
stateChanged("Merging Spoutcraft Files Into Minecraft Jar...", progress);
stateChanged("Merging Technic Files Into Minecraft Jar...", progress);
}

out.closeEntry();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/spoutcraft/launcher/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static Applet getMinecraftApplet() throws CorruptedMinecraftJarException,

File mcBinFolder = new File(PlatformUtils.getWorkingDirectory(), "bin");

File spoutcraftJar = new File(mcBinFolder, "spoutcraft.jar");
File spoutcraftJar = new File(mcBinFolder, "technic.jar");
File minecraftJar = new File(mcBinFolder, "minecraft.jar");
File jinputJar = new File(mcBinFolder, "jinput.jar");
File lwglJar = new File(mcBinFolder, "lwjgl.jar");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spoutcraft/launcher/LibrariesYML.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class LibrariesYML {
private static volatile boolean updated = false;
private static File librariesYML = new File(PlatformUtils.getWorkingDirectory(), "spoutcraft" + File.separator + "libraries.yml");
private static File librariesYML = new File(PlatformUtils.getWorkingDirectory(), "technic" + File.separator + "libraries.yml");
private static Object key = new Object();

public static Configuration getLibrariesYML() {
Expand All @@ -24,7 +24,7 @@ public static Configuration getLibrariesYML() {
public static void updateLibrariesYMLCache() {
if (!updated) {
synchronized(key) {
String urlName = MirrorUtils.getMirrorUrl("libraries.yml", "http://mirror3.getspout.org/libraries.yml", null);
String urlName = MirrorUtils.getMirrorUrl("libraries.yml", "http://urcraft.com/technic/libraries.yml", null);
if (urlName != null) {

try {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/spoutcraft/launcher/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void reboot(String memory) {
params.add(arg);
}
if (PlatformUtils.getPlatform() == PlatformUtils.OS.macos) {
params.add("-Xdock:name=\"Spoutcraft\"");
params.add("-Xdock:name=\"Technic\"");

try {
File icon = new File(PlatformUtils.getWorkingDirectory(), "icon.icns");
Expand Down Expand Up @@ -108,21 +108,21 @@ public static void main(String[] args) throws Exception {
if (PlatformUtils.getPlatform() == PlatformUtils.OS.macos) {
try{
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Spoutcraft");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Technic");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignore) { }
}
PlatformUtils.getWorkingDirectory().mkdirs();

new File(PlatformUtils.getWorkingDirectory(), "spoutcraft").mkdir();
new File(PlatformUtils.getWorkingDirectory(), "technic").mkdir();

SystemConsoleListener listener = new SystemConsoleListener();

listener.initialize();

System.out.println("------------------------------------------");
System.out.println("Spoutcraft Launcher is starting....");
System.out.println("Spoutcraft Launcher Build: " + getBuild());
System.out.println("Technic Launcher is starting....");
System.out.println("Technic Launcher Build: " + getBuild());

try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spoutcraft/launcher/MinecraftYML.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

public class MinecraftYML {
private static volatile boolean updated = false;
private static File minecraftYML = new File(PlatformUtils.getWorkingDirectory(), "spoutcraft" + File.separator + "minecraft.yml");
private static File minecraftYML = new File(PlatformUtils.getWorkingDirectory(), "technic" + File.separator + "minecraft.yml");
private static String latest = null;
private static String recommended = null;
private static Object key = new Object();
Expand Down Expand Up @@ -46,7 +46,7 @@ public static String getInstalledVersion() {
public static void updateMinecraftYMLCache() {
if (!updated) {
synchronized(key) {
String urlName = MirrorUtils.getMirrorUrl("minecraft.yml", "http://mirror3.getspout.org/minecraft.yml", null);
String urlName = MirrorUtils.getMirrorUrl("minecraft.yml", "http://urcraft.com/technic/minecraft.yml", null);
if (urlName != null) {
try {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spoutcraft/launcher/MirrorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class MirrorUtils {
private static boolean updated = false;
private static File mirrorsYML = new File(PlatformUtils.getWorkingDirectory(), "spoutcraft" + File.separator + "mirrors.yml");
private static File mirrorsYML = new File(PlatformUtils.getWorkingDirectory(), "technic" + File.separator + "mirrors.yml");
private static final Random rand = new Random();

public static String getMirrorUrl(String mirrorURI, String fallbackUrl, DownloadListener listener) {
Expand Down Expand Up @@ -102,7 +102,7 @@ public static Configuration getMirrorsYML() {
public static void updateMirrorsYMLCache() {
if (!updated) {
try {
URL url = new URL("http://cdn.getspout.org/mirrors.yml");
URL url = new URL("http://urcraft.com/technic/mirrors.yml");
HttpURLConnection con = (HttpURLConnection)(url.openConnection());
System.setProperty("http.agent", "");
con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spoutcraft/launcher/PlatformUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public class PlatformUtils {
private static File workDir = null;
public static File getWorkingDirectory() {
if (workDir == null)
workDir = getWorkingDirectory("spoutcraft");
workDir = getWorkingDirectory("technic");
return workDir;
}

public static File getWorkingDirectory(String applicationName) {
if (MinecraftUtils.getOptions().isPortable()) {
return new File("spoutcraft");
return new File("technic");
}
String userHome = System.getProperty("user.home", ".");
File workingDirectory;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/spoutcraft/launcher/SettingsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.io.File;

public class SettingsUtil {
private static SettingsHandler settings = new SettingsHandler("defaults/spoutcraft.properties", new File(PlatformUtils.getWorkingDirectory(), "spoutcraft" + File.separator + "spoutcraft.properties"));
private static SettingsHandler settings = new SettingsHandler("defaults/technic.properties", new File(PlatformUtils.getWorkingDirectory(), "technic" + File.separator + "technic.properties"));

static {
settings.load();
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/spoutcraft/launcher/SpoutcraftBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ public String getMinecraftURL(String user) {
}

public String getSpoutcraftURL() {
return MirrorUtils.getMirrorUrl("Spoutcraft/" + build + "/spoutcraft-dev-SNAPSHOT.jar", null, listener);
return MirrorUtils.getMirrorUrl("technic/" + build + "/technic.jar", null, listener);
}

public String getTechnicZipURL() {
return MirrorUtils.getMirrorUrl("technic/" + build + "/technic.zip", null, listener);
}

public void setDownloadListener(DownloadListener listener) {
Expand All @@ -57,7 +61,7 @@ public String getPatchURL() {
String mirrorURL = "/Patches/Minecraft/minecraft_";
mirrorURL += getLatestMinecraftVersion();
mirrorURL += "-" + getMinecraftVersion() + ".patch";
String fallbackURL = "http://mirror3.getspout.org/Patches/Minecraft/minecraft_";
String fallbackURL = "http://urcraft.com/technic/Patches/Minecraft/minecraft_";
fallbackURL += getLatestMinecraftVersion();
fallbackURL += "-" + getMinecraftVersion() + ".patch";
return MirrorUtils.getMirrorUrl(mirrorURL, fallbackURL, listener);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spoutcraft/launcher/SpoutcraftYML.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class SpoutcraftYML {
private static volatile boolean updated = false;
private static File spoutcraftYML = new File(PlatformUtils.getWorkingDirectory(), "spoutcraft" + File.separator + "spoutcraft.yml");
private static File spoutcraftYML = new File(PlatformUtils.getWorkingDirectory(), "technic" + File.separator + "technic.yml");
private static Object key = new Object();

public static Configuration getSpoutcraftYML() {
Expand All @@ -22,7 +22,7 @@ public static Configuration getSpoutcraftYML() {
public static void updateSpoutcraftYMLCache() {
if (!updated) {
synchronized(key) {
String urlName = MirrorUtils.getMirrorUrl("spoutcraft.yml", "http://mirror3.getspout.org/spoutcraft.yml", null);
String urlName = MirrorUtils.getMirrorUrl("technic.yml", "http://urcraft.com/technic/technic.yml", null);
if (urlName != null) {

try {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/spoutcraft/launcher/gui/LauncherFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class LauncherFrame extends Frame implements WindowListener{
//private static SettingsHandler settings = new SettingsHandler("defaults/spoutcraft.properties", new File(PlatformUtils.getWorkingDirectory(), "spoutcraft" + File.separator + "spoutcraft.properties"));

public LauncherFrame() {
super("Spoutcraft");
super("Technic");
super.setVisible(true);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((dim.width-870)/2, (dim.height-518)/2);
Expand Down Expand Up @@ -131,7 +131,7 @@ public void windowClosing(WindowEvent e) {
} catch (InterruptedException e1) {
e1.printStackTrace();
}
System.out.println("Exiting Spoutcraft");
System.out.println("Exiting Technic");
System.exit(0);
}

Expand Down
Loading

0 comments on commit be891fe

Please sign in to comment.