I'm trying to revive a mod back to the current version of minecraft and I have fixed most errors but I can't find a work around for the following errors.
GuiDisconnected.java
package net.minecraft.client.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Iterator;
import java.util.List;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.I18n;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import java.io.File;
@SideOnly(Side.CLIENT)
public class GuiDisconnected extends GuiScreen
{
/** The error message. */
private String errorMessage;
/** The details about the error. */
private String errorDetail;
private Object[] field_74247_c;
private List field_74245_d;
private final GuiScreen field_98095_n;
/* Auto Reconnect >>> */
private String ar_ip;
private int ar_port;
private int ar_timeout;
private int ar_timeout_count;
private GuiButton ar_reconnectbutton;
private long ar_start;
//public GuiDisconnected(GuiScreen par1GuiScreen, String par2Str, String par3Str, Object ... par4ArrayOfObj)
public GuiDisconnected(GuiScreen par1GuiScreen, String par1Str, String par2Str, String par3Str, int par4, Object ... par4ArrayOfObj)
{
this.field_98095_n = par1GuiScreen;
this.errorMessage = I18n.getString(par2Str);
//this.errorDetail = par3Str;
this.field_74247_c = par4ArrayOfObj;
StringTranslate var5 = StringTranslate.getInstance();
this.field_98095_n = par1GuiScreen;
this.errorMessage = var5.translateKey(par1Str);
this.errorDetail = par2Str;
this.field_74247_c = par4ArrayOfObj;
this.ar_ip = par3Str;
this.ar_port = par4;
this.ar_timeout = 10;
this.ar_timeout_count = this.ar_timeout;
this.ar_start = System.currentTimeMillis();
}
/**
* Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
*/
protected void keyTyped(char par1, int par2) {}
/**
* Adds the buttons (and other controls) to the screen in question.
*/
public void initGui()
{
StringTranslate var1 = StringTranslate.getInstance();
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.toMenu")));
/* Auto Reconnect >>> */
this.buttonList.add(this.ar_reconnectbutton = new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96 + 12, "Reconnect"));
/* Auto Reconnect <<< */
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.toMenu")));
if (this.field_74247_c != null)
{
this.field_74245_d = this.fontRenderer.listFormattedStringToWidth(I18n.getStringParams(this.errorDetail, this.field_74247_c), this.width - 50);
}
else
{
this.field_74245_d = this.fontRenderer.listFormattedStringToWidth(I18n.getString(this.errorDetail), this.width - 50);
}
}
/**
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
*/
protected void actionPerformed(GuiButton par1GuiButton)
{
if (par1GuiButton.id == 0)
{
this.mc.displayGuiScreen(this.field_98095_n);
}
/* Auto Reconnect >>> */
else if (par1GuiButton.id== 1)
{
this.ar_timeout_count = this.ar_timeout;
ServerData sv = getServerDataFromIp(this.ar_ip);
if (sv == null) {
this.mc.displayGuiScreen(new GuiConnecting(field_98095_n, this.mc, this.ar_ip, this.ar_port));
}
else {
this.mc.displayGuiScreen(new GuiConnecting(field_98095_n, this.mc, sv));
}
}
/* Auto Reconnect <<< */
}
/**
* Draws the screen and all the components in it.
*/
public void drawScreen(int par1, int par2, float par3)
{
this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, this.errorMessage, this.width / 2, this.height / 2 - 50, 11184810);
int k = this.height / 2 - 30;
if (this.field_74245_d != null)
{
for (Iterator iterator = this.field_74245_d.iterator(); iterator.hasNext(); k += this.fontRenderer.FONT_HEIGHT)
{
String s = (String)iterator.next();
this.drawCenteredString(this.fontRenderer, s, this.width / 2, k, 16777215);
}
}
/* Auto Reconnect >>> */
StringTranslate stringtranslate = StringTranslate.getInstance();
if (this.errorDetail != stringtranslate.translateKey("disconnect.genericReason")) {
long ar_end = System.currentTimeMillis();
if (ar_end - this.ar_start >= 1000L) {
this.ar_start = ar_end;
this.ar_timeout_count -= 1;
}
this.ar_reconnectbutton.displayString = ("Reconnecting in " + this.ar_timeout_count);
if (this.ar_timeout_count == 0)
{
actionPerformed(this.ar_reconnectbutton);
this.ar_timeout_count = this.ar_timeout;
this.ar_start = System.currentTimeMillis();
}
}
/* Auto Reconnect <<< */
super.drawScreen(par1, par2, par3);
}
/* Auto Reconnect >>> */
public ServerData getServerDataFromIp(String ip) {
ServerData sd = null;
NBTTagCompound var1 = null;
try {
var1 = CompressedStreamTools.read(new File(this.mc.mcDataDir, "servers.dat"));
} catch (Exception e) {
e.printStackTrace();
}
NBTTagList var2 = var1.getTagList("servers");
for (int var3 = 0; var3 < var2.tagCount(); ++var3)
{
NBTTagCompound tag = (NBTTagCompound)var2.tagAt(var3);
if (tag.getString("ip").equals(ip)) {
sd = ServerData.getServerDataFromNBTCompound(tag);
}
}
return sd;
}
/* Auto Reconnect <<< */
}
GuiDisconnected.java
I'm getting errors on
Any ideas?
Here is the rest of the code with no errors:
NetClientHandler.java
and ThreadConnectToServer.java