aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/nei/HeatingCoilSpecialValueFormatter.java
blob: f6f0a4099ff6cdcb88576a4b6591580d332a3fa2 (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
package gregtech.nei;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

import gregtech.api.enums.HeatingCoilLevel;

public class HeatingCoilSpecialValueFormatter implements INEISpecialInfoFormatter {

    public static final HeatingCoilSpecialValueFormatter INSTANCE = new HeatingCoilSpecialValueFormatter();

    @Override
    public List<String> format(NEIRecipeInfo recipeInfo, Function<Integer, String> applyPrefixAndSuffix) {
        int heat = recipeInfo.recipe.mSpecialValue;

        List<String> result = new ArrayList<>();
        result.add(applyPrefixAndSuffix.apply(heat));

        for (HeatingCoilLevel heatLevel : HeatingCoilLevel.values()) {
            if (heatLevel == HeatingCoilLevel.None || heatLevel == HeatingCoilLevel.ULV) continue;
            if (heatLevel.getHeat() >= heat) {
                result.add(" (" + heatLevel.getName() + ")");
                return result;
            }
        }
        result.add(" (" + HeatingCoilLevel.MAX.getName() + "+)");
        return result;
    }
}