use of logisticspipes.interfaces.routing.IFluidSink in project LogisticsPipes by RS485.
the class LogisticsFluidManager method getBestReply.
@Override
public Pair<Integer, Integer> getBestReply(FluidStack stack, IRouter sourceRouter, List<Integer> jamList) {
for (ExitRoute candidateRouter : sourceRouter.getIRoutersByCost()) {
if (!candidateRouter.containsFlag(PipeRoutingConnectionType.canRouteTo)) {
continue;
}
if (candidateRouter.destination.getSimpleID() == sourceRouter.getSimpleID()) {
continue;
}
if (jamList.contains(candidateRouter.destination.getSimpleID())) {
continue;
}
if (candidateRouter.destination.getPipe() == null || !candidateRouter.destination.getPipe().isEnabled()) {
continue;
}
CoreRoutedPipe pipe = candidateRouter.destination.getPipe();
if (!(pipe instanceof IFluidSink)) {
continue;
}
int amount = ((IFluidSink) pipe).sinkAmount(stack);
if (amount > 0) {
Pair<Integer, Integer> result = new Pair<>(candidateRouter.destination.getSimpleID(), amount);
return result;
}
}
Pair<Integer, Integer> result = new Pair<>(0, 0);
return result;
}
Aggregations