@Override public void update() { LinkedList<TubeItem> removeQueue = new LinkedList<TubeItem>(); for (TubeItem t : itemFlow) { t.update(); if (t.hasCrossedCenter) { if (!t.pathFoundByParent) { // TODO Pathfind from here and set item.direction under these conditions: // 1) If this pipe is a node (contains a turn point) // 2) If item cannot continue straight. } t.pathFoundByParent = true; } if (t.progress > 100) { BlockCoord bc = new BlockCoord(x(), y(), z()).offset(t.direction); TileMultipart tile = BasicUtils.getMultipartTile(world(), bc); if (tile != null) { TMultiPart tp = tile.partMap(6); if (tp instanceof ITubeInterface && ((ITubeInterface) tp).addItem(t, t.direction)) { removeQueue.add(t); } } } } itemFlow.removeAll(removeQueue); }
public boolean connect(int absDir) { BlockCoord pos = new BlockCoord(getTile()).offset(absDir); TileMultipart t = BasicUtils.getMultipartTile(world(), pos); if (t != null) { TMultiPart tp = t.partMap(6); if (tp instanceof ITubeConnectable) return ((ITubeConnectable) tp).connect(this, absDir ^ 1); } return false; }