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 updateAnimation() 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.textureList.size()) % this.textureList.size(); i < 0; i = (i + this.textureList.size()) % this.textureList.size()) 062 { 063 ; 064 } 065 066 if (i != this.frameCounter) 067 { 068 this.frameCounter = i; 069 this.textureSheet.copyFrom(this.originX, this.originY, (Texture)this.textureList.get(this.frameCounter), this.rotated); 070 } 071 } 072}