aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
blob: 2388a92cd321d0e9342af66c543d08bf6af402c0 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package gregtech.api.enums;

import net.minecraft.util.EnumChatFormatting;

public enum HeatingCoilLevel {
        None, //                       0
        ULV,  //Not implemented      901
        LV,   //Cupronickel         1801
        MV,   //KANTHAL             2701
        HV,   //NICHROME            3601
        EV,   //TUNGSTENSTEEL       4501
        IV,   //HSSG                5401
        LuV,  //HSSS                6301
        ZPM,  //NAQUADAH            7201
        UV,   //NAQUADAHALLOY       8101
        UHV,  //TRINIUM             9001
        UEV,  //ELECTRUMFLUX        9901
        UIV,  //AWAKENEDDRACONIUM  10801
        //Not Implemented yet
        UMV,
        UXV,
        OpV,
        MAX,
        ;

        /**
         * @return the Coils Tier Name
         */
        public String getTierName() {
            if (this.ordinal() < 1 || (this.ordinal()-1) >= GT_Values.VN.length)
                return "ERROR!";
            return GT_Values.TIER_COLORS[this.ordinal() - 1] + GT_Values.VOLTAGE_NAMES[this.ordinal() - 1] + EnumChatFormatting.RESET;
        }

        /**
         * @return the coil heat, used for recipes in the Electronic Blast Furnace for example
         */
        public long getHeat() {
            return this == None ? 0 : 1L + (900L * this.ordinal());
        }

        /**
         * @return the coil tier, used for discount in the Pyrolyse Ofen for example
         */
        public byte getTier() {
            return (byte) (this.ordinal() - 2);
        }

        /**
         * @return the coil Level, used for Parallels in the Multi Furnace for example
         */
        public byte getLevel() {
            return (byte) (1 << Math.min(Math.max(0, this.ordinal() - 2), 4));
        }

        /**
         * @return the coil Discount, used for discount in the Multi Furnace for example
         */
        public int getCostDiscount() {
            return 1 << Math.max(0, this.ordinal() - 5);
        }

        public static HeatingCoilLevel getFromTier(byte tier){
            if (tier < 0 || tier > HeatingCoilLevel.values().length -1)
                return HeatingCoilLevel.None;

            return HeatingCoilLevel.values()[tier+2];
        }
}