001package net.minecraft.client.gui; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import java.util.Iterator; 006import java.util.List; 007import net.minecraft.util.StringTranslate; 008 009@SideOnly(Side.CLIENT) 010public class GuiScreenDisconnectedOnline extends GuiScreen 011{ 012 private String field_98113_a; 013 private String field_98111_b; 014 private Object[] field_98112_c; 015 private List field_98110_d; 016 private final GuiScreen field_98114_n; 017 018 public GuiScreenDisconnectedOnline(GuiScreen par1GuiScreen, String par2Str, String par3Str, Object ... par4ArrayOfObj) 019 { 020 StringTranslate stringtranslate = StringTranslate.getInstance(); 021 this.field_98114_n = par1GuiScreen; 022 this.field_98113_a = stringtranslate.translateKey(par2Str); 023 this.field_98111_b = par3Str; 024 this.field_98112_c = par4ArrayOfObj; 025 } 026 027 /** 028 * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). 029 */ 030 protected void keyTyped(char par1, int par2) {} 031 032 /** 033 * Adds the buttons (and other controls) to the screen in question. 034 */ 035 public void initGui() 036 { 037 StringTranslate stringtranslate = StringTranslate.getInstance(); 038 this.buttonList.clear(); 039 this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, stringtranslate.translateKey("gui.back"))); 040 041 if (this.field_98112_c != null) 042 { 043 this.field_98110_d = this.fontRenderer.listFormattedStringToWidth(stringtranslate.translateKeyFormat(this.field_98111_b, this.field_98112_c), this.width - 50); 044 } 045 else 046 { 047 this.field_98110_d = this.fontRenderer.listFormattedStringToWidth(stringtranslate.translateKey(this.field_98111_b), this.width - 50); 048 } 049 } 050 051 /** 052 * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). 053 */ 054 protected void actionPerformed(GuiButton par1GuiButton) 055 { 056 if (par1GuiButton.id == 0) 057 { 058 this.mc.displayGuiScreen(this.field_98114_n); 059 } 060 } 061 062 /** 063 * Draws the screen and all the components in it. 064 */ 065 public void drawScreen(int par1, int par2, float par3) 066 { 067 this.drawDefaultBackground(); 068 this.drawCenteredString(this.fontRenderer, this.field_98113_a, this.width / 2, this.height / 2 - 50, 11184810); 069 int k = this.height / 2 - 30; 070 071 if (this.field_98110_d != null) 072 { 073 for (Iterator iterator = this.field_98110_d.iterator(); iterator.hasNext(); k += this.fontRenderer.FONT_HEIGHT) 074 { 075 String s = (String)iterator.next(); 076 this.drawCenteredString(this.fontRenderer, s, this.width / 2, k, 16777215); 077 } 078 } 079 080 super.drawScreen(par1, par2, par3); 081 } 082}