File size: 1,363 Bytes
d46f4a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package net.minecraft.world.entity;

import java.util.function.Consumer;

public class AnimationState {
    private static final int STOPPED = Integer.MIN_VALUE;
    private int startTick = Integer.MIN_VALUE;

    public void start(int p_216978_) {
        this.startTick = p_216978_;
    }

    public void startIfStopped(int p_216983_) {
        if (!this.isStarted()) {
            this.start(p_216983_);
        }
    }

    public void animateWhen(boolean p_252220_, int p_249486_) {
        if (p_252220_) {
            this.startIfStopped(p_249486_);
        } else {
            this.stop();
        }
    }

    public void stop() {
        this.startTick = Integer.MIN_VALUE;
    }

    public void ifStarted(Consumer<AnimationState> p_216980_) {
        if (this.isStarted()) {
            p_216980_.accept(this);
        }
    }

    public void fastForward(int p_332215_, float p_335055_) {
        if (this.isStarted()) {
            this.startTick -= (int)((float)p_332215_ * p_335055_);
        }
    }

    public long getTimeInMillis(float p_368031_) {
        float f = p_368031_ - (float)this.startTick;
        return (long)(f * 50.0F);
    }

    public boolean isStarted() {
        return this.startTick != Integer.MIN_VALUE;
    }

    public void copyFrom(AnimationState p_369750_) {
        this.startTick = p_369750_.startTick;
    }
}