001/*
002 * Forge Mod Loader
003 * Copyright (c) 2012-2013 cpw.
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser Public License v2.1
006 * which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
008 *
009 * Contributors:
010 *     cpw - implementation
011 */
012
013package cpw.mods.fml.client;
014
015import net.minecraft.client.gui.GuiErrorScreen;
016import cpw.mods.fml.common.MissingModsException;
017import cpw.mods.fml.common.versioning.ArtifactVersion;
018import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
019
020public class GuiModsMissing extends GuiErrorScreen
021{
022
023    private MissingModsException modsMissing;
024
025    public GuiModsMissing(MissingModsException modsMissing)
026    {
027        this.modsMissing = modsMissing;
028    }
029
030    @Override
031
032    /**
033     * Adds the buttons (and other controls) to the screen in question.
034     */
035    public void initGui()
036    {
037        super.initGui();
038    }
039    @Override
040
041    /**
042     * Draws the screen and all the components in it.
043     */
044    public void drawScreen(int par1, int par2, float par3)
045    {
046        this.drawDefaultBackground();
047        int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10);
048        this.drawCenteredString(this.fontRenderer, "Forge Mod Loader has found a problem with your minecraft installation", this.width / 2, offset, 0xFFFFFF);
049        offset+=10;
050        this.drawCenteredString(this.fontRenderer, "The mods and versions listed below could not be found", this.width / 2, offset, 0xFFFFFF);
051        offset+=5;
052        for (ArtifactVersion v : modsMissing.missingMods)
053        {
054            offset+=10;
055            if (v instanceof DefaultArtifactVersion)
056            {
057                DefaultArtifactVersion dav =  (DefaultArtifactVersion)v;
058                if (dav.getRange() != null && dav.getRange().isUnboundedAbove())
059                {
060                    this.drawCenteredString(this.fontRenderer, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.width / 2, offset, 0xEEEEEE);
061                    continue;
062                }
063            }
064            this.drawCenteredString(this.fontRenderer, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.width / 2, offset, 0xEEEEEE);
065        }
066        offset+=20;
067        this.drawCenteredString(this.fontRenderer, "The file 'ForgeModLoader-client-0.log' contains more information", this.width / 2, offset, 0xFFFFFF);
068    }
069}