aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
blob: a3ef59de4ffe83e72f3c918bdc8b63a2a596bcae (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
package gregtech.common.blocks;

import static gregtech.api.enums.HeatingCoilLevel.*;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.HeatingCoilLevel;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IHeatingCoil;
import gregtech.api.util.GT_LanguageManager;
import java.util.function.Consumer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;

public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHeatingCoil {

    public GT_Block_Casings5() {
        super(GT_Item_Casings5.class, "gt.blockcasings5", GT_Material_Casings.INSTANCE, 16);
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Cupronickel Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Kanthal Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Nichrome Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Tungstensteel Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "HSS-G Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Naquadah Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Naquadah Alloy Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Electrum Flux Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Awakened Draconium Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "HSS-S Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Trinium Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Infinity Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Hypogen Coil Block");
        GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Eternal Coil Block");

        ItemList.Casing_Coil_Cupronickel.set(new ItemStack(this, 1, 0));
        ItemList.Casing_Coil_Kanthal.set(new ItemStack(this, 1, 1));
        ItemList.Casing_Coil_Nichrome.set(new ItemStack(this, 1, 2));
        ItemList.Casing_Coil_TungstenSteel.set(new ItemStack(this, 1, 3));
        ItemList.Casing_Coil_HSSG.set(new ItemStack(this, 1, 4));
        ItemList.Casing_Coil_Naquadah.set(new ItemStack(this, 1, 5));
        ItemList.Casing_Coil_NaquadahAlloy.set(new ItemStack(this, 1, 6));
        ItemList.Casing_Coil_ElectrumFlux.set(new ItemStack(this, 1, 7));
        ItemList.Casing_Coil_AwakenedDraconium.set(new ItemStack(this, 1, 8));
        ItemList.Casing_Coil_HSSS.set(new ItemStack(this, 1, 9));
        ItemList.Casing_Coil_Trinium.set(new ItemStack(this, 1, 10));
        ItemList.Casing_Coil_Infinity.set(new ItemStack(this, 1, 11));
        ItemList.Casing_Coil_Hypogen.set(new ItemStack(this, 1, 12));
        ItemList.Casing_Coil_Eternal.set(new ItemStack(this, 1, 13));
    }

    @Override
    public int getTextureIndex(int aMeta) {
        return (1 << 7) | aMeta;
    }

    @Override
    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int aSide, int aMeta) {
        switch (aMeta) {
            case 0:
                return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getIcon();
            case 1:
                return Textures.BlockIcons.MACHINE_COIL_KANTHAL.getIcon();
            case 2:
                return Textures.BlockIcons.MACHINE_COIL_NICHROME.getIcon();
            case 3:
                return Textures.BlockIcons.MACHINE_COIL_TUNGSTENSTEEL.getIcon();
            case 4:
                return Textures.BlockIcons.MACHINE_COIL_HSSG.getIcon();
            case 5:
                return Textures.BlockIcons.MACHINE_COIL_NAQUADAH.getIcon();
            case 6:
                return Textures.BlockIcons.MACHINE_COIL_NAQUADAHALLOY.getIcon();
            case 7:
                return Textures.BlockIcons.MACHINE_COIL_ELECTRUMFLUX.getIcon();
            case 8:
                return Textures.BlockIcons.MACHINE_COIL_AWAKENEDDRACONIUM.getIcon();
            case 9:
                return Textures.BlockIcons.MACHINE_COIL_HSSS.getIcon();
            case 10:
                return Textures.BlockIcons.MACHINE_COIL_TRINIUM.getIcon();
            case 11:
                return Textures.BlockIcons.MACHINE_COIL_INFINITY.getIcon();
            case 12:
                return Textures.BlockIcons.MACHINE_COIL_HYPOGEN.getIcon();
            case 13:
                return Textures.BlockIcons.MACHINE_COIL_ETERNAL.getIcon();
        }
        return Textures.BlockIcons.MACHINE_COIL_CUPRONICKEL.getIcon();
    }

    /*--------------- COIL CHECK IMPL. ------------*/

    public static HeatingCoilLevel getCoilHeatFromDamage(int meta) {
        switch (meta) {
            case 0:
                return LV;
            case 1:
                return MV;
            case 2:
                return HV;
            case 3:
                return EV;
            case 4:
                return IV;
            case 5:
                return ZPM;
            case 6:
                return UV;
            case 7:
                return UEV;
            case 8:
                return UIV;
            case 9:
                return LuV;
            case 10:
                return UHV;
            case 11:
                return UMV;
            case 12:
                return UXV;
            case 13:
                return MAX;
            default:
                return None;
        }
    }

    public static int getMetaFromCoilHeat(HeatingCoilLevel level) {
        switch (level) {
            case LV:
                return 0;
            case MV:
                return 1;
            case HV:
                return 2;
            case EV:
                return 3;
            case IV:
                return 4;
            case ZPM:
                return 5;
            case UV:
                return 6;
            case UEV:
                return 7;
            case UIV:
                return 8;
            case LuV:
                return 9;
            case UHV:
                return 10;
            case UMV:
                return 11;
            case UXV:
                return 12;
            case MAX:
                return 13;
            default:
                return 0;
        }
    }

    @Override
    public HeatingCoilLevel getCoilHeat(int meta) {
        getOnCoilCheck().accept(this);
        return getCoilHeatFromDamage(meta);
    }

    /*--------------- CALLBACK ------------*/

    private Consumer<IHeatingCoil> callback = coil -> {};

    @Override
    public void setOnCoilCheck(Consumer<IHeatingCoil> callback) {
        this.callback = callback;
    }

    @Override
    public Consumer<IHeatingCoil> getOnCoilCheck() {
        return this.callback;
    }
}