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
|
package gregtech.common.render;
import gregtech.api.interfaces.IColorModulationContainer;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.render.TextureFactory;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
class GT_SidedTexture implements ITexture, IColorModulationContainer {
protected final ITexture[] mTextures;
/**
* DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!!
* <p/>
* Just set this variable to another different Array instead.
* Otherwise some colored things will get Problems.
*/
private final short[] mRGBa;
GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5, short[] aRGBa, boolean aAllowAlpha) {
if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture");
mTextures = new ITexture[]{
TextureFactory.of(aIcon0, aRGBa, aAllowAlpha),
TextureFactory.of(aIcon1, aRGBa, aAllowAlpha),
TextureFactory.of(aIcon2, aRGBa, aAllowAlpha),
TextureFactory.of(aIcon3, aRGBa, aAllowAlpha),
TextureFactory.of(aIcon4, aRGBa, aAllowAlpha),
TextureFactory.of(aIcon5, aRGBa, aAllowAlpha)
};
mRGBa = aRGBa;
}
@Override
public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
mTextures[5].renderXPos(aRenderer, aBlock, aX ,aY, aZ);
}
@Override
public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
mTextures[4].renderXNeg(aRenderer, aBlock, aX ,aY, aZ);
}
@Override
public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
mTextures[1].renderYPos(aRenderer, aBlock, aX ,aY, aZ);
}
@Override
public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
mTextures[0].renderYNeg(aRenderer, aBlock, aX ,aY, aZ);
}
@Override
public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
mTextures[3].renderZPos(aRenderer, aBlock, aX ,aY, aZ);
}
@Override
public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) {
mTextures[2].renderZNeg(aRenderer, aBlock, aX ,aY, aZ);
}
@Override
public short[] getRGBA() {
return mRGBa;
}
@Override
public boolean isValidTexture() {
for (ITexture renderedTexture : mTextures) {
if (!renderedTexture.isValidTexture()) return false;
}
return true;
}
}
|