001package net.minecraft.client.gui; 002 003import cpw.mods.fml.relauncher.Side; 004import cpw.mods.fml.relauncher.SideOnly; 005import java.util.ArrayList; 006import java.util.Collections; 007import net.minecraft.client.Minecraft; 008 009@SideOnly(Side.CLIENT) 010public class GuiScreenLongRunningTask extends GuiScreen 011{ 012 private final int field_96213_b = 666; 013 private final GuiScreen field_96215_c; 014 private final Thread field_98118_d; 015 private volatile String field_96212_d = ""; 016 private volatile boolean field_96219_n = false; 017 private volatile String field_96220_o; 018 private volatile boolean field_96218_p = false; 019 private int field_96216_q = 0; 020 private TaskLongRunning field_96214_r; 021 public static final String[] field_96217_a = new String[] {"\u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583", "_ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584", "_ _ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585", "_ _ _ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586", "_ _ _ _ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587", "_ _ _ _ _ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588", "_ _ _ _ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587", "_ _ _ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586", "_ _ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585", "_ \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584", "\u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583", "\u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _", "\u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _ _", "\u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _ _ _", "\u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _ _ _ _", "\u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _ _ _ _ _", "\u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _ _ _ _", "\u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _ _ _", "\u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _ _", "\u2584 \u2585 \u2586 \u2587 \u2588 \u2587 \u2586 \u2585 \u2584 \u2583 _"}; 022 023 public GuiScreenLongRunningTask(Minecraft par1Minecraft, GuiScreen par2GuiScreen, TaskLongRunning par3TaskLongRunning) 024 { 025 super.buttonList = Collections.synchronizedList(new ArrayList()); 026 this.mc = par1Minecraft; 027 this.field_96215_c = par2GuiScreen; 028 this.field_96214_r = par3TaskLongRunning; 029 par3TaskLongRunning.func_96574_a(this); 030 this.field_98118_d = new Thread(par3TaskLongRunning); 031 } 032 033 public void func_98117_g() 034 { 035 this.field_98118_d.start(); 036 } 037 038 /** 039 * Called from the main game loop to update the screen. 040 */ 041 public void updateScreen() 042 { 043 super.updateScreen(); 044 ++this.field_96216_q; 045 this.field_96214_r.func_96573_a(); 046 } 047 048 /** 049 * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). 050 */ 051 protected void keyTyped(char par1, int par2) {} 052 053 /** 054 * Adds the buttons (and other controls) to the screen in question. 055 */ 056 public void initGui() 057 { 058 this.field_96214_r.func_96571_d(); 059 } 060 061 /** 062 * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). 063 */ 064 protected void actionPerformed(GuiButton par1GuiButton) 065 { 066 if (par1GuiButton.id == 666) 067 { 068 this.field_96218_p = true; 069 this.mc.displayGuiScreen(this.field_96215_c); 070 } 071 072 this.field_96214_r.func_96572_a(par1GuiButton); 073 } 074 075 /** 076 * Draws the screen and all the components in it. 077 */ 078 public void drawScreen(int par1, int par2, float par3) 079 { 080 this.drawDefaultBackground(); 081 this.drawCenteredString(this.fontRenderer, this.field_96212_d, this.width / 2, this.height / 2 - 50, 16777215); 082 this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215); 083 084 if (!this.field_96219_n) 085 { 086 this.drawCenteredString(this.fontRenderer, field_96217_a[this.field_96216_q % field_96217_a.length], this.width / 2, this.height / 2 + 15, 8421504); 087 } 088 089 if (this.field_96219_n) 090 { 091 this.drawCenteredString(this.fontRenderer, this.field_96220_o, this.width / 2, this.height / 2 + 15, 16711680); 092 } 093 094 super.drawScreen(par1, par2, par3); 095 } 096 097 public void func_96209_a(String par1Str) 098 { 099 this.field_96219_n = true; 100 this.field_96220_o = par1Str; 101 this.buttonList.clear(); 102 this.buttonList.add(new GuiButton(666, this.width / 2 - 100, this.height / 4 + 120 + 12, "Back")); 103 } 104 105 public Minecraft func_96208_g() 106 { 107 return this.mc; 108 } 109 110 public void func_96210_b(String par1Str) 111 { 112 this.field_96212_d = par1Str; 113 } 114 115 public boolean func_96207_h() 116 { 117 return this.field_96218_p; 118 } 119}