    001package net.minecraft.client.renderer.texture;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.Minecraft;
    006
    007@SideOnly(Side.CLIENT)
    008public class TextureClock extends TextureStitched
    009{
    010    private double field_94239_h;
    011    private double field_94240_i;
    012
    013    public TextureClock()
    014    {
    015        super("compass");
    016    }
    017
    018    public void func_94219_l()
    019    {
    020        Minecraft minecraft = Minecraft.getMinecraft();
    021        double d0 = 0.0D;
    022
    023        if (minecraft.theWorld != null && minecraft.thePlayer != null)
    024        {
    025            float f = minecraft.theWorld.getCelestialAngle(1.0F);
    026            d0 = (double)f;
    027
    028            if (!minecraft.theWorld.provider.isSurfaceWorld())
    029            {
    030                d0 = Math.random();
    031            }
    032        }
    033
    034        double d1;
    035
    036        for (d1 = d0 - this.field_94239_h; d1 < -0.5D; ++d1)
    037        {
    038            ;
    039        }
    040
    041        while (d1 >= 0.5D)
    042        {
    043            --d1;
    044        }
    045
    046        if (d1 < -1.0D)
    047        {
    048            d1 = -1.0D;
    049        }
    050
    051        if (d1 > 1.0D)
    052        {
    053            d1 = 1.0D;
    054        }
    055
    056        this.field_94240_i += d1 * 0.1D;
    057        this.field_94240_i *= 0.8D;
    058        this.field_94239_h += this.field_94240_i;
    059        int i;
    060
    061        for (i = (int)((this.field_94239_h + 1.0D) * (double)this.field_94226_b.size()) % this.field_94226_b.size(); i < 0; i = (i + this.field_94226_b.size()) % this.field_94226_b.size())
    062        {
    063            ;
    064        }
    065
    066        if (i != this.field_94222_f)
    067        {
    068            this.field_94222_f = i;
    069            this.field_94228_a.func_94281_a(this.field_94224_d, this.field_94225_e, (Texture)this.field_94226_b.get(this.field_94222_f), this.field_94227_c);
    070        }
    071    }
    072}