use of logisticspipes.routing.pathfinder.IPipeInformationProvider in project LogisticsPipes by RS485.
the class PipeTransportLogistics method passToNextPipe.
protected boolean passToNextPipe(LPTravelingItem item, TileEntity tile) {
IPipeInformationProvider information = SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(tile);
if (information != null) {
item.setPosition(item.getPosition() - getPipeLength());
item.setYaw(item.getYaw() + (getYawDiff(item)));
return information.acceptItem(item, container);
}
return false;
}
use of logisticspipes.routing.pathfinder.IPipeInformationProvider in project LogisticsPipes by RS485.
the class MainProxy method checkPipesConnections.
public static boolean checkPipesConnections(TileEntity from, TileEntity to, EnumFacing way, boolean ignoreSystemDisconnection) {
if (from == null || to == null) {
return false;
}
IPipeInformationProvider fromInfo = SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(from);
IPipeInformationProvider toInfo = SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(to);
if (fromInfo == null && toInfo == null) {
return false;
}
if (fromInfo != null) {
if (!fromInfo.canConnect(to, way, ignoreSystemDisconnection)) {
return false;
}
}
if (toInfo != null) {
return toInfo.canConnect(from, way.getOpposite(), ignoreSystemDisconnection);
}
return true;
}
use of logisticspipes.routing.pathfinder.IPipeInformationProvider in project LogisticsPipes by RS485.
the class CoreUnroutedPipe method getDistanceTo.
public double getDistanceTo(int destinationint, EnumFacing ignore, ItemIdentifier ident, boolean isActive, double travled, double max, List<DoubleCoordinates> visited) {
double lowest = Integer.MAX_VALUE;
for (EnumFacing dir : EnumFacing.VALUES) {
if (ignore == dir) {
continue;
}
IPipeInformationProvider information = SimpleServiceLocator.pipeInformationManager.getInformationProviderFor(container.getNextConnectedTile(dir));
if (information != null) {
DoubleCoordinates pos = new DoubleCoordinates(information);
if (visited.contains(pos)) {
continue;
}
visited.add(pos);
lowest = information.getDistanceTo(destinationint, dir.getOpposite(), ident, isActive, travled, Math.min(max, lowest), visited);
visited.remove(pos);
}
}
return lowest;
}
Aggregations