001 package net.minecraft.src;
002
003 import cpw.mods.fml.common.Side;
004 import cpw.mods.fml.common.asm.SideOnly;
005
006 @SideOnly(Side.CLIENT)
007 public class GuiDownloadTerrain extends GuiScreen
008 {
009 /** Network object that downloads the terrain data. */
010 private NetClientHandler netHandler;
011
012 /** Counts the number of screen updates. */
013 private int updateCounter = 0;
014
015 public GuiDownloadTerrain(NetClientHandler par1NetClientHandler)
016 {
017 this.netHandler = par1NetClientHandler;
018 }
019
020 /**
021 * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
022 */
023 protected void keyTyped(char par1, int par2) {}
024
025 /**
026 * Adds the buttons (and other controls) to the screen in question.
027 */
028 public void initGui()
029 {
030 this.controlList.clear();
031 }
032
033 /**
034 * Called from the main game loop to update the screen.
035 */
036 public void updateScreen()
037 {
038 ++this.updateCounter;
039
040 if (this.updateCounter % 20 == 0)
041 {
042 this.netHandler.addToSendQueue(new Packet0KeepAlive());
043 }
044
045 if (this.netHandler != null)
046 {
047 this.netHandler.processReadPackets();
048 }
049 }
050
051 /**
052 * Draws the screen and all the components in it.
053 */
054 public void drawScreen(int par1, int par2, float par3)
055 {
056 this.drawBackground(0);
057 StringTranslate var4 = StringTranslate.getInstance();
058 this.drawCenteredString(this.fontRenderer, var4.translateKey("multiplayer.downloadingTerrain"), this.width / 2, this.height / 2 - 50, 16777215);
059 super.drawScreen(par1, par2, par3);
060 }
061 }