Package logisticspipes.routing

Examples of logisticspipes.routing.ItemRoutingInformation


 
  public static ItemRoutingInformation restoreFromExtraNBTData(TravelingItem item) {
    if(!item.hasExtraData()) return null;
    NBTTagCompound nbt = item.getExtraData();
    if(nbt.hasKey("LPRoutingInformation")) {
      ItemRoutingInformation routingInformation = new ItemRoutingInformation();
      routingInformation.readFromNBT(nbt.getCompoundTag("LPRoutingInformation"));
      return routingInformation;
    }
    return null;
  }
View Full Code Here


   */
  public static void handle(PipeEvent event, Pipe<?> pipe) {
    if(event instanceof DropItem) {
      if(pipe != null) {
        if(pipe.transport instanceof PipeTransportItems) {
          ItemRoutingInformation info = null;
          if(((DropItem)event).item instanceof LPRoutedBCTravelingItem) {
            info = ((LPRoutedBCTravelingItem)((DropItem)event).item).getRoutingInformation();
          } else {
            info = LPRoutedBCTravelingItem.restoreFromExtraNBTData(((DropItem)event).item);
          }
View Full Code Here

        if(stack != null) {
          ItemIdentifier ident = ItemIdentifier.get(stack);
          List<ItemRoutingInformation> needs = itemsOnRoute.get(ident);
          if(needs!=null) {
            for (Iterator<ItemRoutingInformation> iterator = needs.iterator(); iterator.hasNext();) {
              ItemRoutingInformation need = iterator.next();
              int tosend = Math.min(need.getItem().getStackSize(), stack.stackSize);
              if(!useEnergy(6)) break;
              if(tosend < need.getItem().getStackSize()) {
                // if the stack size is not yet equal to what we put in, wait a bit before sending it on, otherwise we have to split the info
//                need.getItem().setStackSize(need.getItem().getStackSize() - tosend); // need partially satisfied from this stack
//                break; // one stack per tick limit?
              } else {
                // assert sent == need.getItemStack()
View Full Code Here

  }

  public int countOnRoute(FluidIdentifier ident) {
    int amount = 0;
    for(Iterator<ItemRoutingInformation> iter = _inTransitToMe.iterator();iter.hasNext();) {
      ItemRoutingInformation next = iter.next();
      ItemIdentifierStack item = next.getItem();
      if(item.getItem().isFluidContainer()) {
        FluidStack liquid = SimpleServiceLocator.logisticsFluidManager.getFluidFromContainer(item);
        if(FluidIdentifier.get(liquid).equals(ident)) {
          amount += liquid.amount;
        }
View Full Code Here

      }
    }

    // remove old items _inTransit -- these should have arrived, but have probably been lost instead. In either case, it will allow a re-send so that another attempt to re-fill the inventory can be made.   
    while(this._inTransitToMe.peek()!=null && this._inTransitToMe.peek().getTickToTimeOut() <= 0){
      final ItemRoutingInformation p=_inTransitToMe.poll();
      if (LPConstants.DEBUG) {
        LogisticsPipes.log.info("Timed Out: "+p.getItem().getFriendlyName() + " (" + p.hashCode() + ")");
      }
      debug.log("Timed Out: "+p.getItem().getFriendlyName() + " (" + p.hashCode() + ")");
    }
    //update router before ticking logic/transport
    getRouter().update(getWorld().getTotalWorldTime() % Configs.LOGISTICS_DETECTION_FREQUENCY == _delayOffset || _initialInit, this);
    getUpgradeManager().securityTick();
    super.updateEntity();
View Full Code Here

    @Getter
    private ItemRoutingInformation info;

    public LPTravelingItemServer(ItemIdentifierStack stack) {
      super();
      info = new ItemRoutingInformation();
      info.setItem(stack);
    }
View Full Code Here

      this.info = info;
    }
   
    public LPTravelingItemServer(NBTTagCompound data) {
      super();
      info = new ItemRoutingInformation();
      this.readFromNBT(data);
    }
View Full Code Here

  }

  public int countOnRoute(ItemIdentifier it) {
    int count = 0;
    for(Iterator<ItemRoutingInformation> iter = _inTransitToMe.iterator();iter.hasNext();) {
      ItemRoutingInformation next = iter.next();
      if(next.getItem().getItem().equals(it))
        count += next.getItem().getStackSize();
    }
    return count;
  }
View Full Code Here

   
    ForgeDirection blocked = null;
   
    if(data.getDestinationUUID() == null) {
      ItemIdentifierStack stack = data.getItemIdentifierStack();
      ItemRoutingInformation result = getPipe().getQueuedForItemStack(stack);
      if(result != null) {
        data.setInformation(result);
        data.getInfo().setItem(stack.clone());
        blocked = data.input.getOpposite();
      }
View Full Code Here

          if(added.stackSize > 0 && arrivingItem instanceof IRoutedItem) {
            tookSome = true;
            ((IRoutedItem)arrivingItem).setBufferCounter(0);
          }
         
          ItemRoutingInformation info ;
         
          if(arrivingItem.getItemIdentifierStack().getStackSize() > 0) {
            // we have some leftovers, we are splitting the stack, we need to clone the info
            info = arrivingItem.getInfo().clone();
            // For InvSysCon
            info.getItem().setStackSize(added.stackSize);
            insertedItemStack(info, tile);
          } else {
            info = arrivingItem.getInfo();
            info.getItem().setStackSize(added.stackSize);
            // For InvSysCon
            insertedItemStack(info, tile);
           
            // back to normal code, break if we've inserted everything, all items disposed of.
            return; // every item has been inserted.
          }
        } else {
          ForgeDirection[] dirs = manager.getCombinedSneakyOrientation();
          for(int i = 0; i < dirs.length; i++) {
            ForgeDirection insertion = dirs[i];
            if(insertion == null) continue;
            ItemStack added = InventoryHelper.getTransactorFor(tile, dir.getOpposite()).add(arrivingItem.getItemIdentifierStack().makeNormalStack(), insertion, true);
           
            arrivingItem.getItemIdentifierStack().lowerStackSize(added.stackSize);
            if(added.stackSize > 0 && arrivingItem instanceof IRoutedItem) {
              tookSome = true;
              ((IRoutedItem)arrivingItem).setBufferCounter(0);
            }
            ItemRoutingInformation info ;
           
            if(arrivingItem.getItemIdentifierStack().getStackSize() > 0) {
              // we have some leftovers, we are splitting the stack, we need to clone the info
              info = arrivingItem.getInfo().clone();
              // For InvSysCon
              info.getItem().setStackSize(added.stackSize);
              insertedItemStack(info, tile);
            } else {
              info = arrivingItem.getInfo();
              info.getItem().setStackSize(added.stackSize);
              // For InvSysCon
              insertedItemStack(info, tile);
              // back to normal code, break if we've inserted everything, all items disposed of.
              return;// every item has been inserted.
            }
View Full Code Here

TOP

Related Classes of logisticspipes.routing.ItemRoutingInformation

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.