aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_Waila.java
blob: 1c5b5301c82d6bc389f47666fc87c1c4d6912b86 (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
package gregtech.api.util;

public abstract class GT_Waila {

    public static String getMachineProgressString(boolean isActive, int maxProgress, int progress) {
        return getMachineProgressString(isActive, (long) maxProgress, (long) progress);
    }

    public static String getMachineProgressString(boolean isActive, long maxProgress, long progress) {
        final String result;

        if (isActive) {
            if (maxProgress < 20) {
                result = String.format("Progress: %d ticks remaining", maxProgress);
            } else {
                result = String.format("Progress: %d s / %d s", progress / 20, maxProgress / 20);
            }
        } else {
            result = "Idle";
        }

        return result;
    }
}