// Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov  Date: 2/27/2011 11:52:25 PM
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   GuiPalette.java

import java.util.List;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;

public class GuiPalette extends fv
{

    public GuiPalette(jc iinventory, InventoryDebug p)
    {
        super(iinventory, p);
        palette = p;
    }

    public void a()
    {
        super.a();
        extraDepth = new GuiSlider2(50, c / 2 + 2, 3, 10, String.format("Extra Depth: %d", new Object[] {
            Integer.valueOf(b.b.destroyExtraDepth)
        }), (float)b.b.destroyExtraDepth / 16F);
        extraWidth = new GuiSlider2(50, c / 2 - 2 - extraDepth.a, 3, 10, String.format("Extra Width: %d", new Object[] {
            Integer.valueOf(b.b.destroyExtraWidth)
        }), (float)b.b.destroyExtraWidth / 5F);
        e.add(extraDepth);
        e.add(extraWidth);
    }

    protected void keyTyped(char c, int i)
    {
        super.keyTyped(c, i);
        if(i == 65 && palette.firstItem > 1)
            palette.fillInventoryBackwards(palette.firstItem - 1);
        else
        if(i == 66 && !palette.atEnd)
            palette.fillInventory(palette.lastItem + 1);
    }

    public void a(int i, int j, float f)
    {
        super.a(i, j, f);
        GL11.glPushMatrix();
        GL11.glDisable(2896);
        GL11.glDisable(2929);
        for(int k = 0; k < e.size(); k++)
        {
            hw guibutton = (hw)e.get(k);
            guibutton.a(b, i, j);
        }

        GL11.glEnable(2896);
        GL11.glEnable(2929);
        GL11.glPopMatrix();
        b.b.destroyExtraDepth = (int)Math.min(16F * extraDepth.i, 15F);
        b.b.destroyExtraWidth = (int)Math.min(5F * extraWidth.i, 4F);
        extraWidth.e = String.format("Extra Width: %d", new Object[] {
            Integer.valueOf(b.b.destroyExtraWidth)
        });
        extraDepth.e = String.format("Extra Depth: %d", new Object[] {
            Integer.valueOf(b.b.destroyExtraDepth)
        });
    }

    protected void a(int i, int j, int k)
    {
        if(k == 0)
        {
            for(int l = 0; l < e.size(); l++)
            {
                hw guibutton = (hw)e.get(l);
                if(guibutton.c(b, i, j))
                {
                    a = guibutton;
                    b.z.a("random.click", 1.0F, 1.0F);
                    a(guibutton);
                }
            }

        }
        super.a(i, j, k);
    }

    protected void b(int i, int j, int k)
    {
        if(a != null && k == 0)
        {
            a.a(i, j);
            a = null;
        }
        super.b(i, j, k);
    }

    private InventoryDebug palette;
    GuiSlider2 extraWidth;
    GuiSlider2 extraDepth;
    private hw a;
}