    001package net.minecraft.client.gui.inventory;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.entity.player.InventoryPlayer;
    006import net.minecraft.inventory.ContainerBrewingStand;
    007import net.minecraft.tileentity.TileEntityBrewingStand;
    008import net.minecraft.util.StatCollector;
    009import org.lwjgl.opengl.GL11;
    010
    011@SideOnly(Side.CLIENT)
    012public class GuiBrewingStand extends GuiContainer
    013{
    014    private TileEntityBrewingStand brewingStand;
    015
    016    public GuiBrewingStand(InventoryPlayer par1InventoryPlayer, TileEntityBrewingStand par2TileEntityBrewingStand)
    017    {
    018        super(new ContainerBrewingStand(par1InventoryPlayer, par2TileEntityBrewingStand));
    019        this.brewingStand = par2TileEntityBrewingStand;
    020    }
    021
    022    /**
    023     * Draw the foreground layer for the GuiContainer (everything in front of the items)
    024     */
    025    protected void drawGuiContainerForegroundLayer(int par1, int par2)
    026    {
    027        String s = this.brewingStand.isInvNameLocalized() ? this.brewingStand.getInvName() : StatCollector.translateToLocal(this.brewingStand.getInvName());
    028        this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
    029        this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
    030    }
    031
    032    /**
    033     * Draw the background layer for the GuiContainer (everything behind the items)
    034     */
    035    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
    036    {
    037        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    038        this.mc.renderEngine.bindTexture("/gui/alchemy.png");
    039        int k = (this.width - this.xSize) / 2;
    040        int l = (this.height - this.ySize) / 2;
    041        this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
    042        int i1 = this.brewingStand.getBrewTime();
    043
    044        if (i1 > 0)
    045        {
    046            int j1 = (int)(28.0F * (1.0F - (float)i1 / 400.0F));
    047
    048            if (j1 > 0)
    049            {
    050                this.drawTexturedModalRect(k + 97, l + 16, 176, 0, 9, j1);
    051            }
    052
    053            int k1 = i1 / 2 % 7;
    054
    055            switch (k1)
    056            {
    057                case 0:
    058                    j1 = 29;
    059                    break;
    060                case 1:
    061                    j1 = 24;
    062                    break;
    063                case 2:
    064                    j1 = 20;
    065                    break;
    066                case 3:
    067                    j1 = 16;
    068                    break;
    069                case 4:
    070                    j1 = 11;
    071                    break;
    072                case 5:
    073                    j1 = 6;
    074                    break;
    075                case 6:
    076                    j1 = 0;
    077            }
    078
    079            if (j1 > 0)
    080            {
    081                this.drawTexturedModalRect(k + 65, l + 14 + 29 - j1, 185, 29 - j1, 12, j1);
    082            }
    083        }
    084    }
    085}