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
|
package com.elisis.gtnhlanth.common.hatch;
import static gregtech.api.enums.Dyes.MACHINE_METAL;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import com.elisis.gtnhlanth.common.beamline.BeamLinePacket;
import com.elisis.gtnhlanth.common.beamline.IConnectsToBeamline;
import com.elisis.gtnhlanth.common.beamline.TileBeamline;
import com.github.technus.tectech.util.TT_Utility;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
public class TileHatchOutputBeamline extends TileHatchBeamlineConnector<BeamLinePacket> implements IConnectsToBeamline {
private static final String activeIconPath = "iconsets/OVERLAY_BO_ACTIVE";
private static final String sideIconPath = "iconsets/OVERLAY_BO_SIDES";
private static final String connIconPath = "iconsets/BO_CONN";
private static final Textures.BlockIcons.CustomIcon activeIcon = new Textures.BlockIcons.CustomIcon(activeIconPath);
private static final Textures.BlockIcons.CustomIcon sideIcon = new Textures.BlockIcons.CustomIcon(sideIconPath);
private static final Textures.BlockIcons.CustomIcon connIcon = new Textures.BlockIcons.CustomIcon(connIconPath);
public TileHatchOutputBeamline(int id, String name, String nameRegional, int tier) {
super(id, name, nameRegional, tier, "");
TT_Utility.setTier(tier, this);
}
public TileHatchOutputBeamline(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture,
new GT_RenderedTexture(
activeIcon,
Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())),
new GT_RenderedTexture(connIcon) };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture,
new GT_RenderedTexture(
sideIcon,
Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())),
new GT_RenderedTexture(connIcon) };
}
@Override
public IConnectsToBeamline getNext(IConnectsToBeamline source) {
IGregTechTileEntity base = this.getBaseMetaTileEntity();
IGregTechTileEntity next = base.getIGregTechTileEntityAtSide(base.getFrontFacing());
if (next == null) {
return null;
}
IMetaTileEntity meta = next.getMetaTileEntity();
if (meta instanceof TileBeamline) {
((TileBeamline) meta).markUsed();
return (IConnectsToBeamline) meta;
} else if (meta instanceof TileHatchInputBeamline && ((TileHatchInputBeamline) meta).canConnect(
base.getFrontFacing()
.getOpposite())) {
return (IConnectsToBeamline) meta;
}
return null;
}
@Override
public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) {
IConnectsToBeamline current = this, source = this, next;
int range = 0;
while ((next = current.getNext(source)) != null && range++ < 100) {
if (next instanceof TileHatchInputBeamline) {
((TileHatchInputBeamline) next).setContents(q);
break;
}
source = current;
current = next;
}
q = null;
}
@Override
protected BeamLinePacket loadPacketFromNBT(NBTTagCompound nbt) {
return new BeamLinePacket(nbt);
}
@Override
public boolean canConnect(ForgeDirection side) {
return this.isOutputFacing(side);
}
@Override
public boolean isDataInputFacing(ForgeDirection side) {
return this.isInputFacing(side);
}
@Override
public boolean isFacingValid(ForgeDirection facing) {
return true;
}
@Override
public boolean isInputFacing(ForgeDirection aSide) {
return false;
}
@Override
public boolean isOutputFacing(ForgeDirection side) {
return side == this.getBaseMetaTileEntity()
.getFrontFacing();
}
@Override
public String[] getDescription() {
return null;
}
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) {
return new TileHatchOutputBeamline(mName, mTier, mDescriptionArray, mTextures);
}
}
|