Package logisticspipes.routing.order

Examples of logisticspipes.routing.order.LogisticsOrder


 
  @Override
  public void registerExtras(LogisticsPromise promise) {
    ItemIdentifierStack stack = new ItemIdentifierStack(promise.item,promise.numberOfItems);
    _extras.add(new LogisticsOrder(stack, null, RequestType.EXTRA, null));
  }
View Full Code Here


   
    if (!_orderManager.hasOrders(RequestType.PROVIDER) || getWorld().getTotalWorldTime() % 6 != 0) return;

    int itemsleft = itemsToExtract();
    int stacksleft = stacksToExtract();
    LogisticsOrder firstOrder = null;
    LogisticsOrder order = null;
    while (itemsleft > 0 && stacksleft > 0 && _orderManager.hasOrders(RequestType.PROVIDER) && (firstOrder == null || firstOrder != order)) {
      if(firstOrder == null)
        firstOrder = order;
      order = _orderManager.peekAtTopRequest(RequestType.PROVIDER);
      int sent = sendStack(order.getItem(), itemsleft, order.getDestination().getRouter().getSimpleID(), order.getInformation());
      if(sent < 0) break;
      spawnParticle(Particles.VioletParticle, 3);
      stacksleft -= 1;
      itemsleft -= sent;
    }
View Full Code Here

    if (++currentTick < ticksToAction) return;
    currentTick = 0;
    checkUpdate(null);
    int itemsleft = itemsToExtract();
    int stacksleft = stacksToExtract();
    LogisticsOrder firstOrder = null;
    LogisticsOrder order = null;
    while (itemsleft > 0 && stacksleft > 0 && _service.getOrderManager().hasOrders(RequestType.PROVIDER) && (firstOrder == null || firstOrder != order)) {
      if(firstOrder == null)
        firstOrder = order;
      order = _service.getOrderManager().peekAtTopRequest(RequestType.PROVIDER);
      int sent = sendStack(order.getItem(), itemsleft, order.getDestination().getRouter().getSimpleID(), order.getInformation());
      if(sent < 0) break;
      _service.spawnParticle(Particles.VioletParticle, 3);
      stacksleft -= 1;
      itemsleft -= sent;
    }
View Full Code Here

    LinkedLogisticsOrderList list = new LinkedLogisticsOrderList();
    for(RequestTreeNode subNode:subRequests) {
      list.getSubOrders().add(subNode.fullFill());
    }
    for(LogisticsPromise promise:promises) {
      LogisticsOrder result = promise.sender.fullFill(promise, target, info);
      if(result != null) {
        list.add(result);
      }
    }
    for(LogisticsPromise promise:extrapromises) {
View Full Code Here

  }

  @Override
  public void registerExtras(LogisticsPromise promise) {
    ItemIdentifierStack stack = new ItemIdentifierStack(promise.item,promise.numberOfItems);
    _extras.add(new LogisticsOrder(stack, null, RequestType.EXTRA, null));
   
  }
View Full Code Here

    _service.spawnParticle(Particles.VioletParticle, 2);
   
    int itemsleft = itemsToExtract();
    int stacksleft = stacksToExtract();
    while (itemsleft > 0 && stacksleft > 0 && (_service.getOrderManager().hasOrders(RequestType.CRAFTING) || !_extras.isEmpty())) {
      LogisticsOrder nextOrder;
      boolean processingOrder=false;
      if(_service.getOrderManager().hasOrders(RequestType.CRAFTING)){
        nextOrder = _service.getOrderManager().peekAtTopRequest(RequestType.CRAFTING); // fetch but not remove.
        processingOrder=true;
      } else {
        nextOrder = _extras.getFirst(); // fetch but not remove.
      }
      int maxtosend = Math.min(itemsleft, nextOrder.getItem().getStackSize());
      maxtosend = Math.min(nextOrder.getItem().getItem().getMaxStackSize(), maxtosend);
      // retrieve the new crafted items
      ItemStack extracted = null;
      AdjacentTile tile = null;
      for (Iterator<AdjacentTile> it = crafters.iterator(); it.hasNext();) {
        tile = it.next();
        extracted = extract(tile, nextOrder.getItem().getItem(), maxtosend);
        if (extracted != null && extracted.stackSize > 0) {
          break;
        }
      }
      if(extracted == null || extracted.stackSize == 0) {
        if(processingOrder)
          _service.getOrderManager().deferSend();
        break;
      }
      lastAccessedCrafter = new WeakReference<TileEntity>(tile.tile);
      // send the new crafted items to the destination
      ItemIdentifier extractedID = ItemIdentifier.get(extracted);
      while (extracted.stackSize > 0) {
        if(!nextOrder.getItem().getItem().equals(extractedID)) {
          LogisticsOrder startOrder = nextOrder;
          if(_service.getOrderManager().hasOrders(RequestType.CRAFTING)) {
            do {
              _service.getOrderManager().deferSend();
              nextOrder = _service.getOrderManager().peekAtTopRequest(RequestType.CRAFTING);
            } while(!nextOrder.getItem().getItem().equals(extractedID) && startOrder != nextOrder);
View Full Code Here

TOP

Related Classes of logisticspipes.routing.order.LogisticsOrder

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.