aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtnhlanth/common/hatch
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtnhlanth/common/hatch')
-rw-r--r--src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java49
1 files changed, 44 insertions, 5 deletions
diff --git a/src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java b/src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java
index dfb210d725..00772fb5e8 100644
--- a/src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java
+++ b/src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java
@@ -83,14 +83,53 @@ public class MTEHatchOutputBeamline extends MTEHatchBeamlineConnector<BeamLinePa
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 MTEHatchInputBeamline) {
- ((MTEHatchInputBeamline) next).setContents(q);
+
+ ForgeDirection front = this.getBaseMetaTileEntity()
+ .getFrontFacing();
+
+ for (int distance = 1; distance <= 129; distance++) { // 128 pipes max
+
+ IGregTechTileEntity nextTE = (IGregTechTileEntity) this.getBaseMetaTileEntity()
+ .getTileEntityAtSideAndDistance(front, distance); // Straight line transmission only
+
+ if (nextTE == null) {
+ return;
+ }
+
+ IMetaTileEntity nextMeta = nextTE.getMetaTileEntity();
+
+ if (nextMeta == null || !(nextMeta instanceof IConnectsToBeamline)) { // Non-beamliney block
+ return;
+ }
+
+ if (((IConnectsToBeamline) nextMeta) instanceof MTEHatchInputBeamline) {
+ ((MTEHatchInputBeamline) nextMeta).setContents(q); // Reached another multi
break;
+
+ } else if (((IConnectsToBeamline) nextMeta) instanceof MTEBeamlinePipe) { // Another pipe follows
+
+ if (((MTEBeamlinePipe) nextMeta).isDataInputFacing(front.getOpposite())) { // Connected to previous pipe
+ ((MTEBeamlinePipe) nextMeta).markUsed();
+ } else {
+ return;
+ }
+
+ } else {
+ return;
}
- source = current;
- current = next;
+
}
+
+ /*
+ * while ((next = current.getNext(source)) != null && range++ < 100) {
+ * if (next instanceof TileHatchInputBeamline) {
+ * ((TileHatchInputBeamline) next).setContents(q);
+ * break;
+ * }
+ * source = current;
+ * current = next;
+ * }
+ */
q = null;
}