Package logisticspipes.utils.item

Examples of logisticspipes.utils.item.ItemIdentifier$ItemIdentifierCleanupThread


    }
  }

  protected void buildMissingMap(Map<ItemIdentifier,Integer> missing) {
    if(amountLeft() != 0) {
      ItemIdentifier item = liquid.getItemIdentifier();
      Integer count = missing.get(item);
      if(count == null)
        count = 0;
      count += amountLeft();
      missing.put(item, count);
View Full Code Here


  }

  protected void buildUsedMap(Map<ItemIdentifier,Integer> used, Map<ItemIdentifier,Integer> missing) {
    int usedcount = promiseFluidAmount;
    if(usedcount != 0) {
      ItemIdentifier item = liquid.getItemIdentifier();
      Integer count = used.get(item);
      if(count == null)
        count = 0;
      count += usedcount;
      used.put(item, count);
    }
    if(amountLeft() != 0) {
      ItemIdentifier item = liquid.getItemIdentifier();
      Integer count = missing.get(item);
      if(count == null)
        count = 0;
      count += amountLeft();
      missing.put(item, count);
View Full Code Here

 
  // returns -1 on permanently failed, don't try another stack this tick
  // returns 0 on "unable to do this delivery"
  private int sendStack(ItemIdentifierStack stack, int maxCount, int destination, IAdditionalTargetInformation info) {
    ItemIdentifier item = stack.getItem();
    IInventoryUtil inv = _service.getPointedInventory(_extractionMode,true);
    if (inv == null) {
      _service.getOrderManager().sendFailed();
      return 0;
    }
   
    int available = inv.itemCount(item);
    if (available == 0) {
      _service.getOrderManager().sendFailed();
      return 0;
    }
    int wanted = Math.min(available, stack.getStackSize());
    wanted = Math.min(wanted, maxCount);
    wanted = Math.min(wanted, item.getMaxStackSize());
    IRouter dRtr = SimpleServiceLocator.routerManager.getRouterUnsafe(destination,false);
    if(dRtr == null) {
      _service.getOrderManager().sendFailed();
      return 0;
    }
View Full Code Here

  public Map<ItemIdentifier, Integer> getItemsAndCount() {
    Map<ItemIdentifier, Integer> items = new LinkedHashMap<ItemIdentifier, Integer>();
    for (int i = _cropStart; i < _inventory.getSizeInventory() - _cropEnd; i++){
      ItemStack stack = _inventory.getStackInSlot(i);
      if (stack == null) continue;
      ItemIdentifier itemId = ItemIdentifier.get(stack);
      int stackSize = stack.stackSize - (_hideOnePerStack?1:0);
      Integer currentSize = items.get(itemId);
      if (currentSize==null){
        items.put(itemId, stackSize - (_hideOne?1:0));
      } else {
View Full Code Here

  public static boolean request(List<ItemIdentifierStack> items, IRequestItems requester, RequestLog log, EnumSet<ActiveRequestType> requestFlags, IAdditionalTargetInformation info) {
    Map<ItemIdentifier,Integer> messages = new HashMap<ItemIdentifier,Integer>();
    RequestTree tree = new RequestTree(new ItemIdentifierStack(ItemIdentifier.get(Item.getItemFromBlock(Blocks.stone), 0, null), 0), requester, null, requestFlags, info);
    boolean isDone = true;
    for(ItemIdentifierStack stack:items) {
      ItemIdentifier item = stack.getItem();
      Integer count = messages.get(item);
      if(count == null)
        count = 0;
      count += stack.getStackSize();
      messages.put(item, count);
View Full Code Here

    return list;
  }

  protected void buildMissingMap(Map<ItemIdentifier,Integer> missing) {
    if(getMissingItemCount() != 0) {
      ItemIdentifier item = request.getItem();
      Integer count = missing.get(item);
      if(count == null)
        count = 0;
      count += getMissingItemCount();
      missing.put(item, count);
View Full Code Here

      if(promise.type == PromiseType.PROVIDER) {
        usedcount += promise.numberOfItems;
      }
    }
    if(usedcount != 0) {
      ItemIdentifier item = request.getItem();
      Integer count = used.get(item);
      if(count == null)
        count = 0;
      count += usedcount;
      used.put(item, count);
    }
    if(getMissingItemCount() != 0) {
      ItemIdentifier item = request.getItem();
      Integer count = missing.get(item);
      if(count == null)
        count = 0;
      count += getMissingItemCount();
      missing.put(item, count);
View Full Code Here

    }
      String idString = args[0];
      String metaString = args[1];
      int id = Integer.valueOf(idString);
      int meta = Integer.valueOf(metaString);
      ItemIdentifier item = ItemIdentifier.get(Item.getItemById(id), meta, null);
      sender.addChatMessage(new ChatComponentText("Name: " + item.getFriendlyNameCC()));
  }
View Full Code Here

  @Override
  public void canProvide(RequestTreeNode tree, int donePromisses, List<IFilter> filters) {
   
    if (_extras.isEmpty()) return;
   
    ItemIdentifier requestedItem = tree.getStackItem();
   
    if(!canCraft(requestedItem)) {
      return;
    }
   
    for(IFilter filter:filters) {
      if(filter.isBlocked() == filter.isFilteredItem(requestedItem.getUndamaged()) || filter.blockProvider()) return;
    }
    int remaining = 0;
    for(LogisticsOrder extra:_extras){
      if(extra.getItem().getItem().equals(requestedItem)){
        remaining += extra.getItem().getStackSize();
View Full Code Here

          _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);
          }
          if(startOrder == nextOrder) {
            int numtosend = Math.min(extracted.stackSize, extractedID.getMaxStackSize());
            if(numtosend == 0)
              break;
            stacksleft -= 1;
            itemsleft -= numtosend;
            ItemStack stackToSend = extracted.splitStack(numtosend);
            //Route the unhandled item
           
            _service.sendStack(stackToSend, -1, ItemSendMode.Normal, null) ;
            continue;
          }
        }
        int numtosend = Math.min(extracted.stackSize, extractedID.getMaxStackSize());
        numtosend = Math.min(numtosend, nextOrder.getItem().getStackSize());
        if(numtosend == 0)
          break;
        stacksleft -= 1;
        itemsleft -= numtosend;
View Full Code Here

TOP

Related Classes of logisticspipes.utils.item.ItemIdentifier$ItemIdentifierCleanupThread

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.