package net.minecraft.client.renderer.vertex;

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@SideOnly(Side.CLIENT)
public class VertexFormatElement
{
    private static final Logger field_177381_a = LogManager.getLogger();
    private final VertexFormatElement.EnumType field_177379_b;
    private final VertexFormatElement.EnumUsage field_177380_c;
    private int field_177377_d;
    private int field_177378_e;
    private int field_177376_f;
    private static final String __OBFID = "CL_00002399";

    public VertexFormatElement(int p_i46096_1_, VertexFormatElement.EnumType p_i46096_2_, VertexFormatElement.EnumUsage p_i46096_3_, int p_i46096_4_)
    {
        if (!this.func_177372_a(p_i46096_1_, p_i46096_3_))
        {
            field_177381_a.warn("Multiple vertex elements of the same type other than UVs are not supported. Forcing type to UV.");
            this.field_177380_c = VertexFormatElement.EnumUsage.UV;
        }
        else
        {
            this.field_177380_c = p_i46096_3_;
        }

        this.field_177379_b = p_i46096_2_;
        this.field_177377_d = p_i46096_1_;
        this.field_177378_e = p_i46096_4_;
        this.field_177376_f = 0;
    }

    public void func_177371_a(int p_177371_1_)
    {
        this.field_177376_f = p_177371_1_;
    }

    public int func_177373_a()
    {
        return this.field_177376_f;
    }

    private final boolean func_177372_a(int p_177372_1_, VertexFormatElement.EnumUsage p_177372_2_)
    {
        return p_177372_1_ == 0 || p_177372_2_ == VertexFormatElement.EnumUsage.UV;
    }

    public final VertexFormatElement.EnumType func_177367_b()
    {
        return this.field_177379_b;
    }

    public final VertexFormatElement.EnumUsage func_177375_c()
    {
        return this.field_177380_c;
    }

    public final int func_177370_d()
    {
        return this.field_177378_e;
    }

    public final int func_177369_e()
    {
        return this.field_177377_d;
    }

    public String toString()
    {
        return this.field_177378_e + "," + this.field_177380_c.func_177384_a() + "," + this.field_177379_b.func_177396_b();
    }

    public final int func_177368_f()
    {
        return this.field_177379_b.func_177395_a() * this.field_177378_e;
    }

    public final boolean func_177374_g()
    {
        return this.field_177380_c == VertexFormatElement.EnumUsage.POSITION;
    }

    public boolean equals(Object p_equals_1_)
    {
        if (this == p_equals_1_)
        {
            return true;
        }
        else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass())
        {
            VertexFormatElement vertexformatelement = (VertexFormatElement)p_equals_1_;
            return this.field_177378_e != vertexformatelement.field_177378_e ? false : (this.field_177377_d != vertexformatelement.field_177377_d ? false : (this.field_177376_f != vertexformatelement.field_177376_f ? false : (this.field_177379_b != vertexformatelement.field_177379_b ? false : this.field_177380_c == vertexformatelement.field_177380_c)));
        }
        else
        {
            return false;
        }
    }

    public int hashCode()
    {
        int i = this.field_177379_b.hashCode();
        i = 31 * i + this.field_177380_c.hashCode();
        i = 31 * i + this.field_177377_d;
        i = 31 * i + this.field_177378_e;
        i = 31 * i + this.field_177376_f;
        return i;
    }

    @SideOnly(Side.CLIENT)
    public static enum EnumType
    {
        FLOAT(4, "Float", 5126),
        UBYTE(1, "Unsigned Byte", 5121),
        BYTE(1, "Byte", 5120),
        USHORT(2, "Unsigned Short", 5123),
        SHORT(2, "Short", 5122),
        UINT(4, "Unsigned Int", 5125),
        INT(4, "Int", 5124);
        private final int field_177407_h;
        private final String field_177408_i;
        private final int field_177405_j;

        private static final String __OBFID = "CL_00002398";

        private EnumType(int p_i46095_3_, String p_i46095_4_, int p_i46095_5_)
        {
            this.field_177407_h = p_i46095_3_;
            this.field_177408_i = p_i46095_4_;
            this.field_177405_j = p_i46095_5_;
        }

        public int func_177395_a()
        {
            return this.field_177407_h;
        }

        public String func_177396_b()
        {
            return this.field_177408_i;
        }

        public int func_177397_c()
        {
            return this.field_177405_j;
        }
    }

    @SideOnly(Side.CLIENT)
    public static enum EnumUsage
    {
        POSITION("Position"),
        NORMAL("Normal"),
        COLOR("Vertex Color"),
        UV("UV"),
        MATRIX("Bone Matrix"),
        BLEND_WEIGHT("Blend Weight"),
        PADDING("Padding");
        private final String field_177392_h;

        private static final String __OBFID = "CL_00002397";

        private EnumUsage(String p_i46094_3_)
        {
            this.field_177392_h = p_i46094_3_;
        }

        public String func_177384_a()
        {
            return this.field_177392_h;
        }
    }
}