Mekanism-tilera-Edition/src/minecraft/mekanism/client/GuiCredits.java
Aidan Brady 5f496a00ec v5.5.4 Beta #6
*A new model for the Metallurgic Infuser.
*Fixed and made better the auto-updater.
*Reverted to LiquidSlot-based tank on the Bio-Generator.
*Sustained liquid in the Electrolytic Separator and Electric Pump.
*Better liquid cleanups.

Still need to add recipe for Electric Pump!
2013-04-05 16:26:48 -04:00

111 lines
3.5 KiB
Java

package mekanism.client;
import cpw.mods.fml.common.Loader;
import mekanism.api.EnumColor;
import mekanism.common.Mekanism;
import mekanism.common.MekanismUtils;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
public class GuiCredits extends GuiScreen
{
private static String updateProgress = "";
private boolean updatedRecently;
private boolean notified = false;
@Override
public void initGui()
{
buttonList.clear();
buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 72 + 12, "Update"));
buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 96 + 12, "Cancel"));
((GuiButton)buttonList.get(0)).enabled = !MekanismUtils.isNotOutdated() && !ThreadClientUpdate.hasUpdated;
}
public static void onFinishedDownloading()
{
updateProgress = "Successfully updated. Restart Minecraft to load.";
System.out.println("[Mekanism] Successfully updated to latest version (" + Mekanism.latestVersionNumber + ").");
ThreadClientUpdate.hasUpdated = true;
}
public static void onErrorDownloading()
{
updateProgress = EnumColor.DARK_RED + "Error updating.";
}
@Override
protected void actionPerformed(GuiButton guibutton)
{
if(!guibutton.enabled)
{
return;
}
if(guibutton.id == 0)
{
if(!MekanismUtils.isNotOutdated())
{
updatedRecently = true;
updateProgress = "Downloading latest version...";
guibutton.enabled = false;
new ThreadClientUpdate("http://dl.dropbox.com/u/90411166/Mekanism-v" + Mekanism.latestVersionNumber + ".jar", 0);
if(Loader.isModLoaded("MekanismGenerators"))
{
new ThreadClientUpdate("http://dl.dropbox.com/u/90411166/MekanismGenerators-v" + Mekanism.latestVersionNumber + ".jar", 1);
}
if(Loader.isModLoaded("MekanismTools"))
{
new ThreadClientUpdate("http://dl.dropbox.com/u/90411166/MekanismTools-v" + Mekanism.latestVersionNumber + ".jar", 2);
}
}
else {
updateProgress = "You already have the latest version.";
}
}
if(guibutton.id == 1)
{
mc.displayGuiScreen(null);
}
}
public void writeText(String text, int yAxis)
{
drawString(fontRenderer, text, width / 2 - 140, (height / 4 - 60) + 20 + yAxis, 0xa0a0a0);
}
@Override
public boolean doesGuiPauseGame()
{
return false;
}
@Override
public void drawScreen(int i, int j, float f)
{
if(updatedRecently && ThreadClientUpdate.modulesBeingDownloaded == 0 && !updateProgress.contains("Error"))
{
if(!notified)
{
onFinishedDownloading();
notified = true;
}
}
else if(ThreadClientUpdate.hasUpdated && !notified)
{
updateProgress = "You have already downloaded the update. Restart MC!";
}
drawDefaultBackground();
drawCenteredString(fontRenderer, EnumColor.DARK_BLUE + "Mekanism" + EnumColor.GREY + " by aidancbrady", width / 2, (height / 4 - 60) + 20, 0xffffff);
writeText(EnumColor.GREY + "Your version: " + (MekanismUtils.isNotOutdated() ? Mekanism.versionNumber : EnumColor.DARK_RED + Mekanism.versionNumber.toString() + EnumColor.GREY + " -- OUTDATED"), 36);
writeText(EnumColor.GREY + "Newest version: " + Mekanism.latestVersionNumber, 45);
writeText(EnumColor.GREY + "*Developed on Mac OS X 10.8 Mountain Lion", 63);
writeText(EnumColor.GREY + "*Code, textures, and ideas by aidancbrady", 72);
writeText(EnumColor.GREY + "Recent news: " + EnumColor.DARK_BLUE + (!Mekanism.recentNews.contains("null") ? Mekanism.recentNews : "couldn't access."), 81);
writeText(EnumColor.GREY + updateProgress, 99);
super.drawScreen(i, j, f);
}
}