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
|
package gtPlusPlus.xmod.gregtech.common.blocks.textures;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class TexturesCentrifugeMultiblock {
private static CustomIcon GT8_1_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE1");
private static CustomIcon GT8_1 = new CustomIcon("iconsets/LARGECENTRIFUGE1");
private static CustomIcon GT8_2_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE2");
private static CustomIcon GT8_2 = new CustomIcon("iconsets/LARGECENTRIFUGE2");
private static CustomIcon GT8_3_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE3");
private static CustomIcon GT8_3 = new CustomIcon("iconsets/LARGECENTRIFUGE3");
private static CustomIcon GT8_4_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE4");
private static CustomIcon GT8_4 = new CustomIcon("iconsets/LARGECENTRIFUGE4");
private static CustomIcon GT8_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5");
private static CustomIcon GT8_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5");
private static CustomIcon GT8_6_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE6");
private static CustomIcon GT8_6 = new CustomIcon("iconsets/LARGECENTRIFUGE6");
private static CustomIcon GT8_7_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE7");
private static CustomIcon GT8_7 = new CustomIcon("iconsets/LARGECENTRIFUGE7");
private static CustomIcon GT8_8_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE8");
private static CustomIcon GT8_8 = new CustomIcon("iconsets/LARGECENTRIFUGE8");
private static CustomIcon GT8_9_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE9");
private static CustomIcon GT8_9 = new CustomIcon("iconsets/LARGECENTRIFUGE9");
private static CustomIcon frontFace_0 = (GT8_1);
private static CustomIcon frontFaceActive_0 = (GT8_1_Active);
private static CustomIcon frontFace_1 = (GT8_2);
private static CustomIcon frontFaceActive_1 = (GT8_2_Active);
private static CustomIcon frontFace_2 = (GT8_3);
private static CustomIcon frontFaceActive_2 = (GT8_3_Active);
private static CustomIcon frontFace_3 = (GT8_4);
private static CustomIcon frontFaceActive_3 = (GT8_4_Active);
private static CustomIcon frontFace_4 = (GT8_5);
private static CustomIcon frontFaceActive_4 = (GT8_5_Active);
private static CustomIcon frontFace_5 = (GT8_6);
private static CustomIcon frontFaceActive_5 = (GT8_6_Active);
private static CustomIcon frontFace_6 = (GT8_7);
private static CustomIcon frontFaceActive_6 = (GT8_7_Active);
private static CustomIcon frontFace_7 = (GT8_8);
private static CustomIcon frontFaceActive_7 = (GT8_8_Active);
private static CustomIcon frontFace_8 = (GT8_9);
private static CustomIcon frontFaceActive_8 = (GT8_9_Active);
CustomIcon[] CENTRIFUGE = new CustomIcon[]{
frontFace_0,
frontFace_1,
frontFace_2,
frontFace_3,
frontFace_4,
frontFace_5,
frontFace_6,
frontFace_7,
frontFace_8
};
CustomIcon[] CENTRIFUGE_ACTIVE = new CustomIcon[]{
frontFaceActive_0,
frontFaceActive_1,
frontFaceActive_2,
frontFaceActive_3,
frontFaceActive_4,
frontFaceActive_5,
frontFaceActive_6,
frontFaceActive_7,
frontFaceActive_8
};
public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
return this.handleCasingsGT58(aWorld, xCoord, yCoord, zCoord, aSide, thisBlock);
}
private static int isCentrifugeControllerWithSide(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if (!(tTileEntity instanceof IGregTechTileEntity)) return 0;
IGregTechTileEntity tTile = (IGregTechTileEntity) tTileEntity;
if (tTile.getMetaTileEntity() instanceof GregtechMetaTileEntity_IndustrialCentrifuge && tTile.getFrontFacing() == aSide)
return tTile.isActive() ? 1 : 2;
return 0;
}
public IIcon handleCasingsGT58(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks thisBlock) {
final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
if (tMeta != 0) {
return CasingTextureHandler.getIcon(aSide, tMeta);
}
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;
if (isCentrifugeControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide) != 0) {
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord + j, yCoord, zCoord + i)).getMetaTileEntity();
return getIconByIndex(tMetaTileEntity, 4 - i * 3 - j);
}
}
}
break;
case 1:
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if (i == 0 && j == 0)
continue;
if (isCentrifugeControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide) != 0) {
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord + j, yCoord + i, zCoord)).getMetaTileEntity();
return getIconByIndex(tMetaTileEntity, 4 + i * 3 - j * tInvertLeftRightMod);
}
}
}
break;
case 2:
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if (i == 0 && j == 0)
continue;
if (isCentrifugeControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide) != 0) {
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aWorld.getTileEntity(xCoord, yCoord + i, zCoord + j)).getMetaTileEntity();
return getIconByIndex(tMetaTileEntity, 4 + i * 3 + j * tInvertLeftRightMod);
}
}
}
break;
}
return TexturesGtBlock.Casing_Material_Centrifuge.getIcon();
}
public boolean isCentrifugeRunning(IMetaTileEntity aTile) {
if (aTile == null) {
return false;
}
else {
return aTile.getBaseMetaTileEntity().isActive();
}
}
public boolean isUsingAnimatedTexture(IMetaTileEntity aMetaTileEntity) {
if (aMetaTileEntity != null) {
if (aMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge) {
return ((GregtechMetaTileEntity_IndustrialCentrifuge) aMetaTileEntity).usingAnimations();
}
}
return false;
}
public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) {
if (isUsingAnimatedTexture(aMetaTileEntity)) {
if (isCentrifugeRunning(aMetaTileEntity)) {
return this.CENTRIFUGE_ACTIVE[aIndex].getIcon();
}
}
return this.CENTRIFUGE[aIndex].getIcon();
}
}
|