summaryrefslogtreecommitdiff
path: root/src/net/minecraft/GameUpdater.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/minecraft/GameUpdater.java')
-rw-r--r--src/net/minecraft/GameUpdater.java37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/net/minecraft/GameUpdater.java b/src/net/minecraft/GameUpdater.java
index 9a79880..1b02053 100644
--- a/src/net/minecraft/GameUpdater.java
+++ b/src/net/minecraft/GameUpdater.java
@@ -2,7 +2,6 @@ package net.minecraft;
import java.applet.Applet;
import java.io.DataInputStream;
-import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -73,12 +72,10 @@ public class GameUpdater implements Runnable {
protected String[] certificateRefusedMessage = new String[]{"Permissions for Applet Refused.", "Please accept the permissions dialog to allow", "the applet to continue the loading process."};
protected static boolean natives_loaded = false;
- private final String latestVersion;
- private final String mainGameUrl;
+ private final GameVersion latestVersion;
- public GameUpdater(String latestVersion, String mainGameUrl) {
+ public GameUpdater(GameVersion latestVersion) {
this.latestVersion = latestVersion;
- this.mainGameUrl = mainGameUrl;
}
public void init() {
@@ -96,6 +93,14 @@ public class GameUpdater implements Runnable {
this.pack200Supported = true;
} catch (Throwable throwable) {
}
+
+ if (!latestVersion.hasFullInfo()) {
+ try {
+ latestVersion.downloadInfo();
+ } catch (IOException e) {
+ fatalErrorOccured("Unable to get info for version", e);
+ }
+ }
}
@@ -176,10 +181,7 @@ public class GameUpdater implements Runnable {
}
this.urlList[1] = new URL(path, librariesZip);
-
- // TODO: BetaCraft's server only has versions missing from mojang's download site.
- // The launcher should use the info in "jsons.zip" to get the URL for the jar download.
- this.urlList[2] = new URL(path, "versions/a1.0.13.jar");
+ this.urlList[2] = latestVersion.gameJarUrl;
}
@@ -209,7 +211,7 @@ public class GameUpdater implements Runnable {
boolean cacheAvailable = false;
if (versionFile.exists() && (
- this.latestVersion.equals("-1") || this.latestVersion.equals(readVersionFile(versionFile)))) {
+ this.latestVersion.equals("-1") || latestVersion.isSameVersion(versionFile))) {
cacheAvailable = true;
this.percentage = 90;
}
@@ -220,10 +222,8 @@ public class GameUpdater implements Runnable {
extractJars(path);
extractNatives(path);
- if (this.latestVersion != null) {
- this.percentage = 90;
- writeVersionFile(versionFile, this.latestVersion);
- }
+ this.percentage = 90;
+ latestVersion.writeVersionFile(versionFile);
}
}
@@ -246,13 +246,6 @@ public class GameUpdater implements Runnable {
return version;
}
- protected void writeVersionFile(File file, String version) throws Exception {
- DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
- dos.writeUTF(version);
- dos.close();
- }
-
-
protected void updateClassPath(File dir) throws Exception {
this.state = STATE_UPDATING_CLASSPATH;
@@ -703,7 +696,7 @@ public class GameUpdater implements Runnable {
if (dir.exists()) {
String version = readVersionFile(dir);
- if (version != null && version.length() > 0) {
+ if (version != null && !version.isEmpty()) {
return true;
}
}