Package logisticspipes.routing

Examples of logisticspipes.routing.IRouter


      throw new NullPointerException();
    }
   
    ((PipeTransportLogistics)transport).injectItem(routedItem, from.getOpposite());
   
    IRouter r = SimpleServiceLocator.routerManager.getRouterUnsafe(routedItem.getDestination(), false);
    if(r != null) {
      CoreRoutedPipe pipe = r.getCachedPipe();
      if(pipe != null) // pipes can unload at inconvenient times ...
        pipe.notifyOfSend(routedItem.getInfo());
      else {
        // TODO: handle sending items to known chunk-unloaded destination?
      }
View Full Code Here


    return ((getWorld().getTotalWorldTime() + _delayOffset) % n == 0);
  }

  private void doDebugStuff(EntityPlayer entityplayer) {
    //entityplayer.worldObj.setWorldTime(4951);
    IRouter r = getRouter();
    if(!(r instanceof ServerRouter)) return;
    System.out.println("***");
    System.out.println("---------Interests---------------");
    for(Entry<ItemIdentifier, Set<IRouter>> i: ServerRouter.getInterestedInSpecifics().entrySet()){
      System.out.print(i.getKey().getFriendlyName()+":");
      for(IRouter j:i.getValue())
        System.out.print(j.getSimpleID()+",");
      System.out.println();
    }
   
    System.out.print("ALL ITEMS:");
    for(IRouter j:ServerRouter.getInterestedInGeneral())
      System.out.print(j.getSimpleID()+",");
    System.out.println();
     
   
   
   
    ServerRouter sr = (ServerRouter) r;
   
    System.out.println(r.toString());
    System.out.println("---------CONNECTED TO---------------");
    for (CoreRoutedPipe adj : sr._adjacent.keySet()) {
      System.out.println(adj.getRouter().getSimpleID());
    }
    System.out.println();
    System.out.println("========DISTANCE TABLE==============");
    for(ExitRoute n : r.getIRoutersByCost()) {
      System.out.println(n.destination.getSimpleID()+ " @ " + n.distanceToDestination + " -> "+ n.connectionDetails +"("+n.destination.getId() +")");
    }
    System.out.println();
    System.out.println("*******EXIT ROUTE TABLE*************");
    List<List<ExitRoute>> table = r.getRouteTable();
    for (int i=0; i < table.size(); i++){     
      if(table.get(i) != null) {
        if(table.get(i).size() > 0) {
          System.out.println(i + " -> " + table.get(i).get(0).destination.getSimpleID());
          for(ExitRoute route:table.get(i)) {
            System.out.println("\t\t via " + route.exitOrientation + "(" + route.distanceToDestination + " distance)");
          }
        }
      }
    }
    System.out.println();
    System.out.println("++++++++++CONNECTIONS+++++++++++++++");
    System.out.println(Arrays.toString(ForgeDirection.VALID_DIRECTIONS));
    System.out.println(Arrays.toString(sr.sideDisconnected));
    System.out.println(Arrays.toString(container.pipeConnectionsBuffer));
    System.out.println();
    System.out.println("~~~~~~~~~~~~~~~POWER~~~~~~~~~~~~~~~~");
    System.out.println(r.getPowerProvider());
    System.out.println();
    System.out.println("~~~~~~~~~~~SUBSYSTEMPOWER~~~~~~~~~~~");
    System.out.println(r.getSubSystemPowerProvider());
    System.out.println();
    System.out.println("################END#################");
    refreshConnectionAndRender(true);
    System.out.print("");
    sr.CreateRouteTable(Integer.MAX_VALUE);
View Full Code Here

    return getRouter().getId().toString();
  }
 
  @CCCommand(description="Returns the Router UUID for the givvin router Id")
  public String getRouterUUID(Double id) {
    IRouter router = SimpleServiceLocator.routerManager.getRouter((int)((double)id));
    if(router == null) return null;
    return router.getId().toString();
  }
View Full Code Here

  @CCDirectCall
  public Object getPipeForUUID(String sUuid) throws PermissionException {
    if(!getUpgradeManager().hasCCRemoteControlUpgrade()) throw new PermissionException();
    UUID uuid = UUID.fromString(sUuid);
    int id = SimpleServiceLocator.routerManager.getIDforUUID(uuid);
    IRouter router = SimpleServiceLocator.routerManager.getRouter(id);
    if(router == null) return null;
    CoreRoutedPipe pipe = router.getPipe();
    if(!(pipe.container instanceof LogisticsTileGenericPipe)) return null;
    return pipe.container;
  }
View Full Code Here

    public void itemWasLost() {
      if(this.container != null) {
        if(MainProxy.isClient(this.container.getWorldObj())) return;
      }
      if (info.destinationint >= 0 && SimpleServiceLocator.routerManager.isRouter(info.destinationint)){
        IRouter destinationRouter = SimpleServiceLocator.routerManager.getRouter(info.destinationint);
        if(destinationRouter.getPipe() != null) {
          destinationRouter.getPipe().notifyOfReroute(info);
          if (destinationRouter.getPipe() instanceof IRequireReliableTransport) {
            ((IRequireReliableTransport)destinationRouter.getPipe()).itemLost(info.getItem().clone(), info.targetInfo);
          }
          if (destinationRouter.getPipe() instanceof IRequireReliableFluidTransport) {
            if(info.getItem().getItem().isFluidContainer()) {
              FluidStack liquid = SimpleServiceLocator.logisticsFluidManager.getFluidFromContainer(info.getItem());
              ((IRequireReliableFluidTransport)destinationRouter.getPipe()).liquidLost(FluidIdentifier.get(liquid), liquid.amount);
            }
          }
        }
      }
    }
View Full Code Here

    }

    @Override
    public void setDestination(int destination) {
      info.destinationint = destination;
      IRouter router = SimpleServiceLocator.routerManager.getRouter(destination);
      if(router != null) {
        info.destinationUUID = router.getId();
      } else {
        info.destinationUUID = null;
      }
    }
View Full Code Here

    }

    @Override
    public void checkIDFromUUID() { 
      IRouterManager rm = SimpleServiceLocator.routerManager;
      IRouter router = rm.getRouter(info.destinationint);
      if(router == null || info.destinationUUID != router.getId()) {
        info.destinationint = rm.getIDforUUID(info.destinationUUID);
      }
    }
View Full Code Here

        info.destinationint = rm.getIDforUUID(info.destinationUUID);
      }
    }

    public void refreshDestinationInformation() {
      IRouter destinationRouter = SimpleServiceLocator.routerManager.getRouter(info.destinationint);
      if (destinationRouter != null && destinationRouter.getPipe() instanceof CoreRoutedPipe){
        ((CoreRoutedPipe) destinationRouter.getPipe()).refreshItem(this.getInfo());
      }
    }
View Full Code Here

    boolean hasSatellite = isSatelliteConnected();
    if(!hasSatellite) return null;
    if(!getUpgradeManager().isAdvancedSatelliteCrafter()) {
      if(satelliteId != 0) {
        IRouter r = getSatelliteRouter(-1);
        if(r != null) {
          IRequestItems sat = r.getPipe();
          for(int i=6;i<9;i++) {
            target[i] = sat;
          }
        }
      }
    } else {
      for(int i=0;i<9;i++) {
        if(advancedSatelliteIdArray[i] != 0) {
          IRouter r = getSatelliteRouter(i);
          if(r != null) target[i] = r.getPipe();
        }
      }
    }

    CraftingTemplate template = new CraftingTemplate(craftingStack, this, priority);

    //Check all materials
    for (int i = 0; i < 9; i++){
      ItemIdentifierStack resourceStack = getMaterials(i);
      if (resourceStack == null || resourceStack.getStackSize() == 0) continue;
      CraftingRequirement req = new CraftingRequirement();
      req.stack = resourceStack;
      if(getUpgradeManager().isFuzzyCrafter())
      {
        if((fuzzyCraftingFlagArray[i] & 0x1) != 0)
          req.use_od = true;
        if((fuzzyCraftingFlagArray[i] & 0x2) != 0)
          req.ignore_dmg = true;
        if((fuzzyCraftingFlagArray[i] & 0x4) != 0)
          req.ignore_nbt = true;
        if((fuzzyCraftingFlagArray[i] & 0x8) != 0)
          req.use_category = true;
      }
      template.addRequirement(req, target[i], new CraftingChassieInformation(i, this.getPositionInt()));
    }
   
    int liquidCrafter = this.getUpgradeManager().getFluidCrafter();
    IRequestFluid[] liquidTarget = new IRequestFluid[liquidCrafter];
   
    if(!getUpgradeManager().isAdvancedSatelliteCrafter()) {
      if(liquidSatelliteId != 0) {
        IRouter r = getFluidSatelliteRouter(-1);
        if(r != null) {
          IRequestFluid sat = (IRequestFluid) r.getPipe();
          for(int i=0;i<liquidCrafter;i++) {
          liquidTarget[i] = sat;
        }
      }
      }
    } else {
      for(int i=0;i<liquidCrafter;i++) {
        if(liquidSatelliteIdArray[i] != 0) {
          IRouter r = getFluidSatelliteRouter(i);
          if(r != null) liquidTarget[i] = (IRequestFluid) r.getPipe();
        }
      }
    }
   
    for (int i = 0; i < liquidCrafter; i++){
View Full Code Here

      for (final PipeItemsSatelliteLogistics satellite : PipeItemsSatelliteLogistics.AllSatellites) {
        if (satellite.satelliteId == satelliteId) {
          CoreRoutedPipe satPipe = satellite;
          if(satPipe == null || satPipe.stillNeedReplace() || satPipe.getRouter() == null)
            continue;
          IRouter satRouter = satPipe.getRouter();
          for (ExitRoute route:routes) {
            if (route.destination == satRouter) {
              return true;
            }
          }
        }
      }
    } else {
      boolean foundAll = true;
      for(int i=0;i<9;i++) {
        boolean foundOne = false;
        if(advancedSatelliteIdArray[i] == 0) {
          continue;
        }
        for (final PipeItemsSatelliteLogistics satellite : PipeItemsSatelliteLogistics.AllSatellites) {
          if (satellite.satelliteId == advancedSatelliteIdArray[i]) {
            CoreRoutedPipe satPipe = satellite;
            if(satPipe == null || satPipe.stillNeedReplace() || satPipe.getRouter() == null)
              continue;
            IRouter satRouter = satPipe.getRouter();
            for (ExitRoute route:routes) {
              if (route.destination == satRouter) {
                foundOne = true;
                break;
              }
View Full Code Here

TOP

Related Classes of logisticspipes.routing.IRouter

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.