    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 GuiProgress extends GuiScreen implements IProgressUpdate
    008    {
    009        private String progressMessage = "";
    010        private String workingMessage = "";
    011        private int currentProgress = 0;
    012        private boolean noMoreProgress;
    013
    014        /**
    015         * "Saving level", or the loading,or downloading equivelent
    016         */
    017        public void displayProgressMessage(String par1Str)
    018        {
    019            this.resetProgressAndMessage(par1Str);
    020        }
    021
    022        /**
    023         * this string, followed by "working..." and then the "% complete" are the 3 lines shown. This resets progress to 0,
    024         * and the WorkingString to "working...".
    025         */
    026        public void resetProgressAndMessage(String par1Str)
    027        {
    028            this.progressMessage = par1Str;
    029            this.resetProgresAndWorkingMessage("Working...");
    030        }
    031
    032        /**
    033         * This is called with "Working..." by resetProgressAndMessage
    034         */
    035        public void resetProgresAndWorkingMessage(String par1Str)
    036        {
    037            this.workingMessage = par1Str;
    038            this.setLoadingProgress(0);
    039        }
    040
    041        /**
    042         * Updates the progress bar on the loading screen to the specified amount. Args: loadProgress
    043         */
    044        public void setLoadingProgress(int par1)
    045        {
    046            this.currentProgress = par1;
    047        }
    048
    049        /**
    050         * called when there is no more progress to be had, both on completion and failure
    051         */
    052        public void onNoMoreProgress()
    053        {
    054            this.noMoreProgress = true;
    055        }
    056
    057        /**
    058         * Draws the screen and all the components in it.
    059         */
    060        public void drawScreen(int par1, int par2, float par3)
    061        {
    062            if (this.noMoreProgress)
    063            {
    064                this.mc.displayGuiScreen((GuiScreen)null);
    065            }
    066            else
    067            {
    068                this.drawDefaultBackground();
    069                this.drawCenteredString(this.fontRenderer, this.progressMessage, this.width / 2, 70, 16777215);
    070                this.drawCenteredString(this.fontRenderer, this.workingMessage + " " + this.currentProgress + "%", this.width / 2, 90, 16777215);
    071                super.drawScreen(par1, par2, par3);
    072            }
    073        }
    074    }