mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
v5.0.1 Beta #2
*Updated to MC v1.4.6. *Updated all APIs. *Repackaged for new Forge. *Added Metallurgic Infuser for making Steel and Bronze. *Added Refined Steel Dust. *Added Refined Steel Ingots. *Made Refined Iron -> Steel Block. *Maps instead of Vectors for recipes. *New recipe managing for Metallurgic Infuser. *Cleaned up imports. *Added new Javadocs. *Made Electrolytic Separator texture changed based on what gas it is outputting. *Other various bugfixes.
This commit is contained in:
1 parent
75e762fd35
commit
45b4510dc7
162 files changed
+1723
-826
No files matched your search
@@ -1,88 +0,0 @@
|
||||
package mekanism.client;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import net.minecraft.client.Minecraft;
|
||||
/**
|
||||
* Thread that downloads the latest release of Mekanism. The older file is deleted and the newly downloaded file takes it's place.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public class ThreadClientUpdate extends Thread
|
||||
{
|
||||
private int bytesDownloaded;
|
||||
private int lastBytesDownloaded;
|
||||
private byte[] buffer = new byte[10240];
|
||||
private URL url;
|
||||
|
||||
public ThreadClientUpdate(String location)
|
||||
{
|
||||
try {
|
||||
url = new URL(location);
|
||||
setDaemon(true);
|
||||
start();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
File download = new File(new StringBuilder().append(Minecraft.getMinecraftDir()).append("/mods/Mekanism.jar").toString());
|
||||
try {
|
||||
prepareForDownload();
|
||||
download.createNewFile();
|
||||
FileOutputStream outputStream = new FileOutputStream(download.getAbsolutePath());
|
||||
InputStream stream = url.openStream();
|
||||
|
||||
while((lastBytesDownloaded = stream.read(buffer)) > 0)
|
||||
{
|
||||
outputStream.write(buffer, 0, lastBytesDownloaded);
|
||||
buffer = new byte[10240];
|
||||
bytesDownloaded += lastBytesDownloaded;
|
||||
}
|
||||
|
||||
outputStream.close();
|
||||
stream.close();
|
||||
GuiCredits.onFinishedDownloading();
|
||||
System.out.println("[Mekanism] Successfully updated to latest version (" + Mekanism.latestVersionNumber + ").");
|
||||
finalize();
|
||||
|
||||
} catch(Throwable e)
|
||||
{
|
||||
GuiCredits.onErrorDownloading();
|
||||
System.err.println("[Mekanism] Error while finishing update thread: " + e.getMessage());
|
||||
try {
|
||||
finalize();
|
||||
} catch (Throwable e1) {
|
||||
System.err.println("[Mekanism] Error while finalizing update thread: " + e1.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares to update to the latest version of Mekanism by deleting the files "Mekanism.cfg" and "Mekanism.jar."
|
||||
*/
|
||||
public void prepareForDownload()
|
||||
{
|
||||
File download = new File(new StringBuilder().append(Minecraft.getMinecraftDir()).append("/mods/Mekanism.jar").toString());
|
||||
File config = new File(new StringBuilder().append(Minecraft.getMinecraftDir()).append("/config/Mekanism.cfg").toString());
|
||||
|
||||
if(download.exists())
|
||||
{
|
||||
download.delete();
|
||||
}
|
||||
if(config.exists())
|
||||
{
|
||||
config.delete();
|
||||
}
|
||||
System.out.println("[Mekanism] Preparing to update...");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user