aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GTWaila.java
blob: 7639aa0225731a172f548e24b9fa3f5d9439c19e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package gregtech.api.util;

public abstract class GTWaila {

    public static String getMachineProgressString(boolean isActive, int maxProgresstime, int progresstime) {
        return getMachineProgressString(isActive, maxProgresstime, (long) progresstime);
    }

    public static String getMachineProgressString(boolean isActive, long maxProgresstime, long progresstime) {

        if (!isActive) return "Idle";

        return "In progress: " + String.format("%,.1f", (double) progresstime / 20)
            + "s / "
            + String.format("%,.1f", (double) maxProgresstime / 20)
            + "s ("
            + String.format("%,.1f", (Math.round((double) progresstime / maxProgresstime * 1000) / 10.0))
            + "%)";
    }
}