Package logisticspipes.routing

Examples of logisticspipes.routing.IRouter$IRAction


  protected int getNextConnectSatelliteId(boolean prev, int x) {
    int closestIdFound = prev ? 0 : Integer.MAX_VALUE;
    for (final PipeItemsSatelliteLogistics satellite : PipeItemsSatelliteLogistics.AllSatellites) {
      CoreRoutedPipe satPipe = satellite;
      if(satPipe == null || satPipe.stillNeedReplace() || satPipe.getRouter() == null || satPipe.isFluidPipe()) continue;
      IRouter satRouter = satPipe.getRouter();
      List<ExitRoute> routes = getRouter().getDistanceTo(satRouter);
      if(routes != null && !routes.isEmpty()) {
        boolean filterFree = false;
        for(ExitRoute route: routes) {
          if(route.filters.isEmpty()) {
View Full Code Here


  protected int getNextConnectFluidSatelliteId(boolean prev, int x) {
    int closestIdFound = prev ? 0 : Integer.MAX_VALUE;
    for (final PipeFluidSatellite satellite : PipeFluidSatellite.AllSatellites) {
      CoreRoutedPipe satPipe = satellite;
      if(satPipe == null || satPipe.stillNeedReplace() || satPipe.getRouter() == null || !satPipe.isFluidPipe()) continue;
      IRouter satRouter = satPipe.getRouter();
      List<ExitRoute> routes = getRouter().getDistanceTo(satRouter);
      if(routes != null && !routes.isEmpty()) {
        boolean filterFree = false;
        for(ExitRoute route: routes) {
          if(route.filters.isEmpty()) {
View Full Code Here

 
  public void handledPipe(boolean flag) {
    for(int i=0;i<closedSet.size();i++) {
      EnumSet<PipeRoutingConnectionType> set = closedSet.get(i);
      if(set != null) {
        IRouter router = SimpleServiceLocator.routerManager.getRouter(i);
        if(router != null) {
          MainProxy.sendPacketToPlayer(PacketHandler.getPacket(RoutingUpdateDebugClosedSet.class).setPos(router.getLPPosition()).setSet(set), (EntityPlayer) sender);
        }
      }
    }
    for(int i=0;i<filterList.size();i++) {
      EnumMap<PipeRoutingConnectionType, List<List<IFilter>>> filters = filterList.get(i);
      if(filters != null) {
        IRouter router = SimpleServiceLocator.routerManager.getRouter(i);
        if(router != null) {
          MainProxy.sendPacketToPlayer(PacketHandler.getPacket(RoutingUpdateDebugFilters.class).setPos(router.getLPPosition()).setFilters(filters), (EntityPlayer) sender);
        }
      }
    }
   
    ExitRoute[] e = candidatesCost.toArray(new ExitRoute[]{});
View Full Code Here

   * @param sourceRouter The UUID of the router pipe that wants to send the stack.
   * @param excludeSource Boolean, true means it will not consider the pipe itself as a valid destination.
   */
  @Override
  public Triplet<Integer, SinkReply, List<IFilter>> hasDestination(ItemIdentifier stack, boolean allowDefault, int sourceID, List<Integer> routerIDsToExclude) {
    IRouter sourceRouter = SimpleServiceLocator.routerManager.getRouter(sourceID);
    if (sourceRouter == null) return null;
    BitSet routersIndex = ServerRouter.getRoutersInterestedIn(stack);
    List<ExitRoute> validDestinations = new ArrayList<ExitRoute>(); // get the routing table
    for (int i = routersIndex.nextSetBit(0); i >= 0; i = routersIndex.nextSetBit(i+1)) {
      IRouter r = SimpleServiceLocator.routerManager.getRouterUnsafe(i,false);
      List<ExitRoute> exits = sourceRouter.getDistanceTo(r);
      if (exits!=null) {
        for(ExitRoute e:exits) {
          if(e.containsFlag(PipeRoutingConnectionType.canRouteTo))
            validDestinations.add(e);
View Full Code Here

  public IRoutedItem assignDestinationFor(IRoutedItem item, int sourceRouterID, boolean excludeSource) {

    //Assert: only called server side.
   
    //If we for some reason can't get the router we can't do anything either
    IRouter sourceRouter = SimpleServiceLocator.routerManager.getRouterUnsafe(sourceRouterID,false);
    if (sourceRouter == null) return item;

    //Wipe current destination
    item.clearDestination();

    BitSet routersIndex = ServerRouter.getRoutersInterestedIn(item.getItemIdentifierStack().getItem());
    List<ExitRoute> validDestinations = new ArrayList<ExitRoute>(); // get the routing table
    for (int i = routersIndex.nextSetBit(0); i >= 0; i = routersIndex.nextSetBit(i+1)) {
      IRouter r = SimpleServiceLocator.routerManager.getRouterUnsafe(i,false);
      List<ExitRoute> exits = sourceRouter.getDistanceTo(r);
      if (exits!=null) {
        for(ExitRoute e:exits) {
          if(e.containsFlag(PipeRoutingConnectionType.canRouteTo))
            validDestinations.add(e);
View Full Code Here

  @Override
  public void processPacket(EntityPlayer player) {
    LogisticsTileGenericPipe tile = this.getPipe(player.worldObj);
    if(tile == null) return;
    if(tile.pipe instanceof CoreRoutedPipe) {
      IRouter router = ((CoreRoutedPipe)tile.pipe).getRouter();

      //this is here to allow players to manually trigger a network-wide LSA update
      router.forceLsaUpdate();

      List<List<ExitRoute>> exits = router.getRouteTable();
      HashMap<ForgeDirection, ArrayList<ExitRoute>> routers = new HashMap<ForgeDirection, ArrayList<ExitRoute>>();
      for(List<ExitRoute> exit:exits) {
        if(exit == null) continue;
        for(ExitRoute e:exit) {
          if(!routers.containsKey(e.exitOrientation)) {
View Full Code Here

          lasers.add(laser);
        }
      }
    }, connectionType);
    for(CoreRoutedPipe connectedPipe: map.keySet()) {
      IRouter newRouter = connectedPipe.getRouter();
      Iterator<ExitRoute> iRoutes = connectedRouters.iterator();
      while(iRoutes.hasNext()) {
        ExitRoute route = iRoutes.next();
        if(route.destination == newRouter) iRoutes.remove();
      }
View Full Code Here

TOP

Related Classes of logisticspipes.routing.IRouter$IRAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.