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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
package gregtech.common.blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_RenderingWorld;
import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine;
public class GT_Block_Casings8 extends GT_Block_Casings_Abstract {
public static boolean mConnectedMachineTextures = true;
// WATCH OUT FOR TEXTURE ID's
public GT_Block_Casings8() {
super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE, 15);
/*
* DO NOT USE INDEX 15 ! USED HERE: https://github.com/GTNewHorizons/Electro-Magic-Tools/pull/17
*/
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mining Neutronium Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Mining Black Plutonium Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Extreme Engine Intake Casing");
GT_LanguageManager.addStringLocalization(
getUnlocalizedName() + ".5.name",
"Europium Reinforced Radiation Proof Machine Casing");
GT_LanguageManager.addStringLocalization(
getUnlocalizedName() + ".6.name",
"Advanced Rhodium Plated Palladium Machine Casing");
GT_LanguageManager.addStringLocalization(
getUnlocalizedName() + ".7.name",
"Advanced Iridium Plated Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Magical Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "HSS-S Turbine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Radiant Naquadah Alloy Casing");
GT_LanguageManager.addStringLocalization(
getUnlocalizedName() + ".11.name",
"Basic Photolithographic Framework Casing");
GT_LanguageManager.addStringLocalization(
getUnlocalizedName() + ".12.name",
"Reinforced Photolithographic Framework Casing");
GT_LanguageManager.addStringLocalization(
getUnlocalizedName() + ".13.name",
"Radiation Proof Photolithographic Framework Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Infinity Cooled Casing");
ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0));
ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1));
ItemList.Casing_MiningNeutronium.set(new ItemStack(this, 1, 2));
ItemList.Casing_MiningBlackPlutonium.set(new ItemStack(this, 1, 3));
ItemList.Casing_ExtremeEngineIntake.set(new ItemStack(this, 1, 4));
ItemList.Casing_AdvancedRadiationProof.set(new ItemStack(this, 1, 5));
ItemList.Casing_Advanced_Rhodium_Palladium.set(new ItemStack(this, 1, 6));
ItemList.Casing_Advanced_Iridium.set(new ItemStack(this, 1, 7));
ItemList.Casing_Magical.set(new ItemStack(this, 1, 8));
ItemList.Casing_TurbineGasAdvanced.set(new ItemStack(this, 1, 9));
ItemList.RadiantNaquadahAlloyCasing.set(new ItemStack(this, 1, 10));
ItemList.BasicPhotolithographicFrameworkCasing.set(new ItemStack(this, 1, 11));
ItemList.ReinforcedPhotolithographicFrameworkCasing.set(new ItemStack(this, 1, 12));
ItemList.RadiationProofPhotolithographicFrameworkCasing.set(new ItemStack(this, 1, 13));
ItemList.InfinityCooledCasing.set(new ItemStack(this, 1, 14));
}
@Override
public int getTextureIndex(int aMeta) {
return (1 << 7) | (aMeta + 48);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int aSide, int aMeta) {
return switch (aMeta) {
case 0 -> Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon();
case 1 -> Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon();
case 2 -> Textures.BlockIcons.MACHINE_CASING_MINING_NEUTRONIUM.getIcon();
case 3 -> Textures.BlockIcons.MACHINE_CASING_MINING_BLACKPLUTONIUM.getIcon();
case 4 -> Textures.BlockIcons.MACHINE_CASING_EXTREME_ENGINE_INTAKE.getIcon(); // changed color in a
// terrible way
case 5 -> Textures.BlockIcons.MACHINE_CASING_ADVANCEDRADIATIONPROOF.getIcon();
case 6 -> Textures.BlockIcons.MACHINE_CASING_RHODIUM_PALLADIUM.getIcon();
case 7 -> Textures.BlockIcons.MACHINE_CASING_IRIDIUM.getIcon();
case 8 -> Textures.BlockIcons.MACHINE_CASING_MAGICAL.getIcon();
case 9 -> Textures.BlockIcons.MACHINE_CASING_ADVANCEDGAS.getIcon();
case 10 -> Textures.BlockIcons.MACHINE_CASING_RADIANT_NAQUADAH_ALLOY.getIcon();
case 11 -> Textures.BlockIcons.MACHINE_CASING_PCB_TIER_1.getIcon();
case 12 -> Textures.BlockIcons.MACHINE_CASING_PCB_TIER_2.getIcon();
case 13 -> Textures.BlockIcons.MACHINE_CASING_PCB_TIER_3.getIcon();
case 14 -> Textures.BlockIcons.INFINITY_COOLED_CASING.getIcon();
default -> Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
};
}
@Deprecated
public IIcon getTurbineCasing(int meta, int iconIndex, boolean active) {
return switch (meta) {
case 9 -> active ? Textures.BlockIcons.TURBINE_ADVGASACTIVE[iconIndex].getIcon()
: Textures.BlockIcons.TURBINEADVGAS[iconIndex].getIcon();
default -> active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon()
: Textures.BlockIcons.TURBINE[iconIndex].getIcon();
};
}
public IIcon getTurbineCasing(int meta, int iconIndex, boolean active, boolean hasTurbine) {
return switch (meta) {
case 9 -> active ? Textures.BlockIcons.TURBINE_ADVGASACTIVE[iconIndex].getIcon()
: hasTurbine ? Textures.BlockIcons.TURBINEADVGAS[iconIndex].getIcon()
: Textures.BlockIcons.TURBINE_ADVGASEMPTY[iconIndex].getIcon();
default -> active ? Textures.BlockIcons.TURBINE_ACTIVE[iconIndex].getIcon()
: hasTurbine ? Textures.BlockIcons.TURBINE[iconIndex].getIcon()
: Textures.BlockIcons.TURBINE_EMPTY[iconIndex].getIcon();
};
}
private static int isTurbineControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (!(tTileEntity instanceof IGregTechTileEntity tTile)) return 0;
if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbine turbine
&& tTile.getFrontFacing() == aSide) {
if (turbine.isNewStyleRendering()) return 0;
if (tTile.isActive()) return 1;
return turbine.hasTurbine() ? 2 : 3;
}
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) {
aWorld = GT_RenderingWorld.getInstance(aWorld);
int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
if (tMeta != 9 || !mConnectedMachineTextures) {
return getIcon(aSide, tMeta);
}
if (tMeta == 9) {
int tInvertLeftRightMod = aSide % 2 * 2 - 1;
switch (aSide / 2) {
case 0 -> {
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if (i == 0 && j == 0) continue;
int tState;
if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide))
!= 0) {
return getTurbineCasing(tMeta, 4 - i * 3 - j, tState == 1, tState == 2);
}
}
}
}
case 1 -> {
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if (i == 0 && j == 0) continue;
int tState;
if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide))
!= 0) {
return getTurbineCasing(
tMeta,
4 + i * 3 - j * tInvertLeftRightMod,
tState == 1,
tState == 2);
}
}
}
}
case 2 -> {
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if (i == 0 && j == 0) continue;
int tState;
if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide))
!= 0) {
return getTurbineCasing(
tMeta,
4 + i * 3 + j * tInvertLeftRightMod,
tState == 1,
tState == 2);
}
}
}
}
}
return switch (tMeta) {
case 9 -> Textures.BlockIcons.MACHINE_CASING_ADVANCEDGAS.getIcon();
default -> Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
};
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
}
}
|