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
|
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
import net.minecraftforge.common.util.ForgeDirection;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.Materials;
import gregtech.api.enums.TextureSet;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.metatileentity.IMetaTileEntityCable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.MTECable;
import gregtech.api.objects.GTRenderedTexture;
public class GTPPMTECable extends MTECable implements IMetaTileEntityCable {
private final short[] vRGB;
public GTPPMTECable(final int aID, final String aName, final String aNameRegional, final float aThickNess,
final Materials aMaterial, final long aCableLossPerMeter, final long aAmperage, final long aVoltage,
final boolean aInsulated, final boolean aCanShock, final short[] aRGB) {
super(
aID,
aName,
aNameRegional,
aThickNess,
aMaterial,
aCableLossPerMeter,
aAmperage,
aVoltage,
aInsulated,
aCanShock);
this.vRGB = aRGB == null || aRGB.length != 4 ? Materials.Iron.mRGBa : aRGB;
}
public GTPPMTECable(final String aName, final float aThickNess, final Materials aMaterial,
final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated,
final boolean aCanShock, final short[] aRGB) {
super(aName, aThickNess, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock);
this.vRGB = aRGB == null || aRGB.length != 4 ? Materials.Iron.mRGBa : aRGB;
}
public GTPPMTECable(final int aID, final String aName, final String aNameRegional, final float aThickNess,
final long aCableLossPerMeter, final long aAmperage, final long aVoltage, final boolean aInsulated,
final boolean aCanShock, final short[] aRGB) {
this(
aID,
aName,
aNameRegional,
aThickNess,
null,
aCableLossPerMeter,
aAmperage,
aVoltage,
aInsulated,
aCanShock,
aRGB);
}
public GTPPMTECable(final String aName, final float aThickNess, final long aCableLossPerMeter, final long aAmperage,
final long aVoltage, final boolean aInsulated, final boolean aCanShock, final short[] aRGB) {
this(aName, aThickNess, null, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock, aRGB);
}
@Override
public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
return new GTPPMTECable(
this.mName,
this.mThickNess,
this.mMaterial,
this.mCableLossPerMeter,
this.mAmperage,
this.mVoltage,
this.mInsulated,
this.mCanShock,
this.vRGB);
}
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, int aConnections,
int aColorIndex, boolean aConnected, boolean aRedstone) {
return getTextureGTNH(aBaseMetaTileEntity, side, aConnections, aColorIndex, aConnected, aRedstone);
}
private ITexture[] getTextureGTNH(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection aSide, int aConnections,
int aColorIndex, boolean aConnected, boolean aRedstone) {
Materials wireMaterial = mMaterial;
if (wireMaterial == null) {
wireMaterial = Materials.Iron;
}
if (!mInsulated) return new ITexture[] { new GTRenderedTexture(
wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire],
Dyes.getModulation(aColorIndex, vRGB)) };
if (aConnected) {
float tThickNess = getThickNess();
if (tThickNess < 0.124F) return new ITexture[] { new GTRenderedTexture(
Textures.BlockIcons.INSULATION_FULL,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.374F) // 0.375 x1
return new ITexture[] {
new GTRenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB),
new GTRenderedTexture(
Textures.BlockIcons.INSULATION_TINY,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.499F) // 0.500 x2
return new ITexture[] {
new GTRenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB),
new GTRenderedTexture(
Textures.BlockIcons.INSULATION_SMALL,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.624F) // 0.625 x4
return new ITexture[] {
new GTRenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB),
new GTRenderedTexture(
Textures.BlockIcons.INSULATION_MEDIUM,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.749F) // 0.750 x8
return new ITexture[] {
new GTRenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB),
new GTRenderedTexture(
Textures.BlockIcons.INSULATION_MEDIUM_PLUS,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
if (tThickNess < 0.874F) // 0.825 x12
return new ITexture[] {
new GTRenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB),
new GTRenderedTexture(
Textures.BlockIcons.INSULATION_LARGE,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
return new ITexture[] { new GTRenderedTexture(wireMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], vRGB),
new GTRenderedTexture(
Textures.BlockIcons.INSULATION_HUGE,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
return new ITexture[] { new GTRenderedTexture(
Textures.BlockIcons.INSULATION_FULL,
Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa)) };
}
}
|