    001package net.minecraft.client.renderer.texture;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005
    006@SideOnly(Side.CLIENT)
    007public class StitchHolder implements Comparable
    008{
    009    private final Texture field_98151_a;
    010    private final int field_94204_c;
    011    private final int field_94201_d;
    012    private boolean field_94202_e;
    013    private float field_94205_a = 1.0F;
    014
    015    public StitchHolder(Texture par1Texture)
    016    {
    017        this.field_98151_a = par1Texture;
    018        this.field_94204_c = par1Texture.func_94275_d();
    019        this.field_94201_d = par1Texture.func_94276_e();
    020        this.field_94202_e = this.func_94193_b(this.field_94201_d) > this.func_94193_b(this.field_94204_c);
    021    }
    022
    023    public Texture func_98150_a()
    024    {
    025        return this.field_98151_a;
    026    }
    027
    028    public int func_94197_a()
    029    {
    030        return this.field_94202_e ? this.func_94193_b((int)((float)this.field_94201_d * this.field_94205_a)) : this.func_94193_b((int)((float)this.field_94204_c * this.field_94205_a));
    031    }
    032
    033    public int func_94199_b()
    034    {
    035        return this.field_94202_e ? this.func_94193_b((int)((float)this.field_94204_c * this.field_94205_a)) : this.func_94193_b((int)((float)this.field_94201_d * this.field_94205_a));
    036    }
    037
    038    public void func_94194_d()
    039    {
    040        this.field_94202_e = !this.field_94202_e;
    041    }
    042
    043    public boolean func_94195_e()
    044    {
    045        return this.field_94202_e;
    046    }
    047
    048    private int func_94193_b(int par1)
    049    {
    050        return (par1 >> 0) + ((par1 & 0) == 0 ? 0 : 1) << 0;
    051    }
    052
    053    public void func_94196_a(int par1)
    054    {
    055        if (this.field_94204_c > par1 && this.field_94201_d > par1)
    056        {
    057            this.field_94205_a = (float)par1 / (float)Math.min(this.field_94204_c, this.field_94201_d);
    058        }
    059    }
    060
    061    public String toString()
    062    {
    063        return "TextureHolder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + '}';
    064    }
    065
    066    public int func_94198_a(StitchHolder par1StitchHolder)
    067    {
    068        int i;
    069
    070        if (this.func_94199_b() == par1StitchHolder.func_94199_b())
    071        {
    072            if (this.func_94197_a() == par1StitchHolder.func_94197_a())
    073            {
    074                if (this.field_98151_a.func_94280_f() == null)
    075                {
    076                    return par1StitchHolder.field_98151_a.func_94280_f() == null ? 0 : -1;
    077                }
    078
    079                return this.field_98151_a.func_94280_f().compareTo(par1StitchHolder.field_98151_a.func_94280_f());
    080            }
    081
    082            i = this.func_94197_a() < par1StitchHolder.func_94197_a() ? 1 : -1;
    083        }
    084        else
    085        {
    086            i = this.func_94199_b() < par1StitchHolder.func_94199_b() ? 1 : -1;
    087        }
    088
    089        return i;
    090    }
    091
    092    public int compareTo(Object par1Obj)
    093    {
    094        return this.func_94198_a((StitchHolder)par1Obj);
    095    }
    096}