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        this.fontRenderer.drawString(StatCollector.translateToLocal("container.brewing"), 56, 6, 4210752);
028        this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
029    }
030
031    /**
032     * Draw the background layer for the GuiContainer (everything behind the items)
033     */
034    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
035    {
036        int var4 = this.mc.renderEngine.getTexture("/gui/alchemy.png");
037        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
038        this.mc.renderEngine.bindTexture(var4);
039        int var5 = (this.width - this.xSize) / 2;
040        int var6 = (this.height - this.ySize) / 2;
041        this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
042        int var7 = this.brewingStand.getBrewTime();
043
044        if (var7 > 0)
045        {
046            int var8 = (int)(28.0F * (1.0F - (float)var7 / 400.0F));
047
048            if (var8 > 0)
049            {
050                this.drawTexturedModalRect(var5 + 97, var6 + 16, 176, 0, 9, var8);
051            }
052
053            int var9 = var7 / 2 % 7;
054
055            switch (var9)
056            {
057                case 0:
058                    var8 = 29;
059                    break;
060                case 1:
061                    var8 = 24;
062                    break;
063                case 2:
064                    var8 = 20;
065                    break;
066                case 3:
067                    var8 = 16;
068                    break;
069                case 4:
070                    var8 = 11;
071                    break;
072                case 5:
073                    var8 = 6;
074                    break;
075                case 6:
076                    var8 = 0;
077            }
078
079            if (var8 > 0)
080            {
081                this.drawTexturedModalRect(var5 + 65, var6 + 14 + 29 - var8, 185, 29 - var8, 12, var8);
082            }
083        }
084    }
085}