    001    package cpw.mods.fml.client;
    002
    003    import net.minecraft.src.GuiButton;
    004    import net.minecraft.src.GuiScreen;
    005    import net.minecraft.src.GuiSmallButton;
    006    import net.minecraft.src.StringTranslate;
    007    import cpw.mods.fml.common.network.ModMissingPacket;
    008    import cpw.mods.fml.common.versioning.ArtifactVersion;
    009
    010    public class GuiModsMissingForServer extends GuiScreen
    011    {
    012        private ModMissingPacket modsMissing;
    013
    014        public GuiModsMissingForServer(ModMissingPacket modsMissing)
    015        {
    016            this.modsMissing = modsMissing;
    017        }
    018
    019        @Override
    020
    021        /**
    022         * Adds the buttons (and other controls) to the screen in question.
    023         */
    024        public void initGui()
    025        {
    026            StringTranslate translations = StringTranslate.getInstance();
    027            this.controlList.add(new GuiSmallButton(1, this.width / 2 - 75, this.height - 38, translations.translateKey("gui.done")));
    028        }
    029
    030        @Override
    031
    032        /**
    033         * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
    034         */
    035        protected void actionPerformed(GuiButton par1GuiButton)
    036        {
    037            if (par1GuiButton.enabled && par1GuiButton.id == 1)
    038            {
    039                FMLClientHandler.instance().getClient().displayGuiScreen(null);
    040            }
    041        }
    042        @Override
    043
    044        /**
    045         * Draws the screen and all the components in it.
    046         */
    047        public void drawScreen(int par1, int par2, float par3)
    048        {
    049            this.drawDefaultBackground();
    050            int offset = Math.max(85 - modsMissing.getModList().size() * 10, 10);
    051            this.drawCenteredString(this.fontRenderer, "Forge Mod Loader could not connect to this server", this.width / 2, offset, 0xFFFFFF);
    052            offset += 10;
    053            this.drawCenteredString(this.fontRenderer, "The mods and versions listed below could not be found", this.width / 2, offset, 0xFFFFFF);
    054            offset += 10;
    055            this.drawCenteredString(this.fontRenderer, "They are required to play on this server", this.width / 2, offset, 0xFFFFFF);
    056            offset += 5;
    057            for (ArtifactVersion v : modsMissing.getModList())
    058            {
    059                offset += 10;
    060                this.drawCenteredString(this.fontRenderer, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.width / 2, offset, 0xEEEEEE);
    061            }
    062            super.drawScreen(par1, par2, par3);
    063        }
    064    }