Search in sources :

Example 6 with IPipeInformationProvider

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;
}
Also used : IPipeInformationProvider(logisticspipes.routing.pathfinder.IPipeInformationProvider)

Example 7 with IPipeInformationProvider

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;
}
Also used : IPipeInformationProvider(logisticspipes.routing.pathfinder.IPipeInformationProvider)

Example 8 with IPipeInformationProvider

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;
}
Also used : IPipeInformationProvider(logisticspipes.routing.pathfinder.IPipeInformationProvider) EnumFacing(net.minecraft.util.EnumFacing) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Aggregations

IPipeInformationProvider (logisticspipes.routing.pathfinder.IPipeInformationProvider)8 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)5 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 EnumFacing (net.minecraft.util.EnumFacing)2 DockingStation (buildcraft.api.robots.DockingStation)1 EntityRobotBase (buildcraft.api.robots.EntityRobotBase)1 PipePluggable (buildcraft.api.transport.pluggable.PipePluggable)1 RobotStationPluggable (buildcraft.robotics.RobotStationPluggable)1 TileGenericPipe (buildcraft.transport.TileGenericPipe)1 ArrayList (java.util.ArrayList)1 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)1 LogisticsRoutingBoardRobot (logisticspipes.proxy.buildcraft.robots.boards.LogisticsRoutingBoardRobot)1 ConnectionInformation (logisticspipes.proxy.specialconnection.SpecialPipeConnection.ConnectionInformation)1 PipeRoutingConnectionType (logisticspipes.routing.PipeRoutingConnectionType)1 TileEntity (net.minecraft.tileentity.TileEntity)1