    001package net.minecraft.client.gui;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import java.util.List;
    006import net.minecraft.client.Minecraft;
    007import net.minecraft.client.mco.Location;
    008import net.minecraft.util.StringTranslate;
    009
    010@SideOnly(Side.CLIENT)
    011public class GuiScreenSelectLocation extends GuiScreen
    012{
    013    protected GuiScreenCreateOnlineWorld field_96242_a;
    014    private int field_96238_b = -1;
    015    private SelectionListLocation field_96239_c;
    016    private GuiSmallButton field_96237_d;
    017    private Location field_96243_n;
    018    private List field_96244_o;
    019    private String field_96241_p;
    020    private String field_96240_q;
    021
    022    public GuiScreenSelectLocation(GuiScreenCreateOnlineWorld par1, List par2, Location par3, String par4Str, String par5Str)
    023    {
    024        this.field_96242_a = par1;
    025        this.field_96244_o = par2;
    026        this.field_96243_n = par3;
    027        this.field_96241_p = par4Str;
    028        this.field_96240_q = par5Str;
    029    }
    030
    031    /**
    032     * Adds the buttons (and other controls) to the screen in question.
    033     */
    034    public void initGui()
    035    {
    036        StringTranslate stringtranslate = StringTranslate.getInstance();
    037        this.buttonList.add(this.field_96237_d = new GuiSmallButton(6, this.width / 2 - 75, this.height - 38, stringtranslate.translateKey("gui.done")));
    038        this.field_96239_c = new SelectionListLocation(this);
    039        this.field_96239_c.registerScrollButtons(this.buttonList, 7, 8);
    040    }
    041
    042    /**
    043     * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
    044     */
    045    protected void actionPerformed(GuiButton par1GuiButton)
    046    {
    047        if (par1GuiButton.enabled)
    048        {
    049            switch (par1GuiButton.id)
    050            {
    051                case 5:
    052                    break;
    053                case 6:
    054                    this.field_96242_a.func_96251_a(this.field_96243_n, this.field_96241_p, this.field_96240_q);
    055                    this.mc.displayGuiScreen(this.field_96242_a);
    056                    break;
    057                default:
    058                    this.field_96239_c.actionPerformed(par1GuiButton);
    059            }
    060        }
    061    }
    062
    063    /**
    064     * Draws the screen and all the components in it.
    065     */
    066    public void drawScreen(int par1, int par2, float par3)
    067    {
    068        this.field_96239_c.drawScreen(par1, par2, par3);
    069
    070        if (this.field_96238_b <= 0)
    071        {
    072            this.mc.texturePackList.updateAvaliableTexturePacks();
    073            this.field_96238_b += 20;
    074        }
    075
    076        StringTranslate stringtranslate = StringTranslate.getInstance();
    077        this.drawCenteredString(this.fontRenderer, stringtranslate.translateKey("mco.create.world.location.title"), this.width / 2, 16, 16777215);
    078        this.drawCenteredString(this.fontRenderer, "(" + stringtranslate.translateKey("mco.create.world.location.warning") + ")", this.width / 2, this.height - 56, 8421504);
    079        super.drawScreen(par1, par2, par3);
    080    }
    081
    082    /**
    083     * Called from the main game loop to update the screen.
    084     */
    085    public void updateScreen()
    086    {
    087        super.updateScreen();
    088        --this.field_96238_b;
    089    }
    090
    091    static Minecraft func_96232_a(GuiScreenSelectLocation par0GuiScreenSelectLocation)
    092    {
    093        return par0GuiScreenSelectLocation.mc;
    094    }
    095
    096    static List func_96236_b(GuiScreenSelectLocation par0GuiScreenSelectLocation)
    097    {
    098        return par0GuiScreenSelectLocation.field_96244_o;
    099    }
    100
    101    static Location func_96234_a(GuiScreenSelectLocation par0GuiScreenSelectLocation, Location par1Location)
    102    {
    103        return par0GuiScreenSelectLocation.field_96243_n = par1Location;
    104    }
    105
    106    static GuiSmallButton func_96230_c(GuiScreenSelectLocation par0GuiScreenSelectLocation)
    107    {
    108        return par0GuiScreenSelectLocation.field_96237_d;
    109    }
    110
    111    static Location func_96233_d(GuiScreenSelectLocation par0GuiScreenSelectLocation)
    112    {
    113        return par0GuiScreenSelectLocation.field_96243_n;
    114    }
    115
    116    static FontRenderer func_96231_e(GuiScreenSelectLocation par0GuiScreenSelectLocation)
    117    {
    118        return par0GuiScreenSelectLocation.fontRenderer;
    119    }
    120
    121    static FontRenderer func_96235_f(GuiScreenSelectLocation par0GuiScreenSelectLocation)
    122    {
    123        return par0GuiScreenSelectLocation.fontRenderer;
    124    }
    125}