use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class PipeItemsInvSysConnector method invalidate.
@Override
public void invalidate() {
if (!stillNeedReplace) {
CoreRoutedPipe CRP = SimpleServiceLocator.connectionManager.getConnectedPipe(getRouter());
SimpleServiceLocator.connectionManager.removeDirectConnection(getRouter());
if (CRP != null) {
CRP.refreshRender(true);
}
}
init = false;
super.invalidate();
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class PipeItemsInvSysConnector method enabledUpdateEntity.
@Override
public void enabledUpdateEntity() {
super.enabledUpdateEntity();
if (!init) {
if (hasConnectionUUID()) {
if (!SimpleServiceLocator.connectionManager.addDirectConnection(getConnectionUUID(), getRouter())) {
dropFreqCard();
}
CoreRoutedPipe CRP = SimpleServiceLocator.connectionManager.getConnectedPipe(getRouter());
if (CRP != null) {
CRP.refreshRender(true);
}
getRouter().update(true, this);
refreshRender(true);
init = true;
idbuffer = getConnectionUUID();
}
}
if (init && !hasConnectionUUID()) {
init = false;
CoreRoutedPipe CRP = SimpleServiceLocator.connectionManager.getConnectedPipe(getRouter());
SimpleServiceLocator.connectionManager.removeDirectConnection(getRouter());
if (CRP != null) {
CRP.refreshRender(true);
}
}
if (init && idbuffer != null && !idbuffer.equals(getConnectionUUID())) {
init = false;
CoreRoutedPipe CRP = SimpleServiceLocator.connectionManager.getConnectedPipe(getRouter());
SimpleServiceLocator.connectionManager.removeDirectConnection(getRouter());
if (CRP != null) {
CRP.refreshRender(true);
}
}
if (itemsOnRoute.size() > 0) {
checkConnectedInvs();
}
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class EnderIOHyperCubeConnection method transmit.
@Override
public void transmit(TileEntity tile, IRoutedItem data) {
List<TileEntity> list = getConnections(tile);
if (list.size() < 1) {
return;
}
TileEntity pipe = list.get(0);
if (pipe instanceof LogisticsTileGenericPipe) {
((CoreRoutedPipe) ((LogisticsTileGenericPipe) pipe).pipe).queueUnroutedItemInformation(data.getItemIdentifierStack().clone(), data.getInfo());
} else {
new RuntimeException("Only LP pipes can be next to Tesseracts to queue item information").printStackTrace();
}
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class EnderIOHyperCubeConnection method getConnections.
@Override
public List<TileEntity> getConnections(TileEntity tile) {
boolean onlyOnePipe = false;
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(tile), direction);
TileEntity canidate = p.getTileEntity(tile.getWorldObj());
if (canidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(tile, canidate, direction)) {
if (onlyOnePipe) {
onlyOnePipe = false;
break;
} else {
onlyOnePipe = true;
}
}
}
if (!onlyOnePipe || !SimpleServiceLocator.enderIOProxy.isSendAndReceive(tile)) {
return new ArrayList<>(0);
}
List<? extends TileEntity> connections = SimpleServiceLocator.enderIOProxy.getConnectedHyperCubes(tile);
List<TileEntity> list = new ArrayList<>();
for (TileEntity connected : connections) {
if (!SimpleServiceLocator.enderIOProxy.isSendAndReceive(connected)) {
continue;
}
LogisticsTileGenericPipe pipe = null;
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(connected), direction);
TileEntity canidate = p.getTileEntity(tile.getWorldObj());
if (canidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(connected, canidate, direction)) {
if (pipe != null) {
pipe = null;
break;
} else {
pipe = (LogisticsTileGenericPipe) canidate;
}
}
}
if (pipe != null && pipe.pipe instanceof CoreRoutedPipe) {
list.add(pipe);
}
}
if (list.size() == 1) {
return list;
} else {
return new ArrayList<>(0);
}
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class ItemAmountPipeSign method spread.
private void spread(Map<ItemIdentifier, Integer> availableItems, BitSet set) {
// Improve performance by updating a wall of Amount pipe signs all at once
IRouter router = pipe.getRouter();
if (set.get(router.getSimpleID()))
return;
set.set(router.getSimpleID());
for (ExitRoute exit : router.getIRoutersByCost()) {
// Only when the signs are in one wall. To not spread to far.
if (exit.distanceToDestination > 2)
break;
if (!exit.filters.isEmpty())
continue;
if (set.get(exit.destination.getSimpleID()))
continue;
if (exit.connectionDetails.contains(PipeRoutingConnectionType.canRequestFrom) && exit.connectionDetails.contains(PipeRoutingConnectionType.canRouteTo)) {
CoreRoutedPipe cachedPipe = exit.destination.getCachedPipe();
if (cachedPipe != null) {
List<Pair<ForgeDirection, IPipeSign>> pipeSigns = cachedPipe.getPipeSigns();
pipeSigns.stream().filter(signPair -> signPair != null && signPair.getValue2() instanceof ItemAmountPipeSign).forEach(signPair -> ((ItemAmountPipeSign) signPair.getValue2()).updateStats(availableItems, set));
}
}
}
}
Aggregations