aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/java/me/lucko/spark/profiler/TickCounter.java
blob: 53a9c276938a0ec98d75cf359a2bcd9d11c9c2fb (plain)
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
package me.lucko.spark.profiler;

/**
 * A hook with the game's "tick loop".
 */
public interface TickCounter {

    /**
     * Starts the counter
     */
    void start();

    /**
     * Stops the counter
     */
    void close();

    /**
     * Gets the current tick number
     *
     * @return the current tick
     */
    long getCurrentTick();

    /**
     * Adds a task to be called each time the tick increments
     *
     * @param runnable the task
     */
    void addTickTask(Runnable runnable);

    /**
     * Removes a tick task
     *
     * @param runnable the task
     */
    void removeTickTask(Runnable runnable);

}