TextureClock .java

net.minecraft.client.renderer.texture.TextureClock (class, 64 lines): members: currentAngle, angleDelta, updateAnimation. imports: Minecraft.

net.minecraft.client.renderer.textureclass64 linesclientextends TextureAtlasSprite1.8 KB

API Surface (1)

void updateAnimation()

Fields & Constants (2)

currentAngle
angleDelta

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

TextureClock.java64 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.renderer.texture;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.util.MathHelper;
5
6
public class TextureClock extends TextureAtlasSprite
7
{
8
    private double currentAngle;
9
    private double angleDelta;
10
11
    public TextureClock(String iconName)
12
    {
13
        super(iconName);
14
    }
15
16
    public void updateAnimation()
17
    {
18
        if (!this.framesTextureData.isEmpty())
19
        {
20
            Minecraft minecraft = Minecraft.getMinecraft();
21
            double d0 = 0.0D;
22
23
            if (minecraft.theWorld != null && minecraft.thePlayer != null)
24
            {
25
                d0 = (double)minecraft.theWorld.getCelestialAngle(1.0F);
26
27
                if (!minecraft.theWorld.provider.isSurfaceWorld())
28
                {
29
                    d0 = Math.random();
30
                }
31
            }
32
33
            double d1;
34
35
            for (d1 = d0 - this.currentAngle; d1 < -0.5D; ++d1)
36
            {
37
                ;
38
            }
39
40
            while (d1 >= 0.5D)
41
            {
42
                --d1;
43
            }
44
45
            d1 = MathHelper.clamp_double(d1, -1.0D, 1.0D);
46
            this.angleDelta += d1 * 0.1D;
47
            this.angleDelta *= 0.8D;
48
            this.currentAngle += this.angleDelta;
49
            int i;
50
51
            for (i = (int)((this.currentAngle + 1.0D) * (double)this.framesTextureData.size()) % this.framesTextureData.size(); i < 0; i = (i + this.framesTextureData.size()) % this.framesTextureData.size())
52
            {
53
                ;
54
            }
55
56
            if (i != this.frameCounter)
57
            {
58
                this.frameCounter = i;
59
                TextureUtil.uploadTextureMipmap((int[][])this.framesTextureData.get(this.frameCounter), this.width, this.height, this.originX, this.originY, false, false);
60
            }
61
        }
62
    }
63
}
64

Deobfuscated MCP 1.8.9 source of TextureClock from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/renderer/texture/TextureClock.java), stored verbatim.