Package logisticspipes.utils.item

Examples of logisticspipes.utils.item.ItemIdentifier


      slot.putStack(tstack);
      if(slot instanceof DummySlot) ((DummySlot)slot).setRedirectCall(false);
      return currentlyEquippedStack;
    }
   
    ItemIdentifier currentItem = ItemIdentifier.get(currentlyEquippedStack);
    ItemIdentifier slotItem = ItemIdentifier.get(slot.getStack());
    if(currentItem.equals(slotItem)) {
      ItemStack tstack = slot.getStack();
      // Do manual shift-checking to play nice with NEI
      int counter = isShift == 1 ? 10 : 1;
      if(mouseButton == 1) {
View Full Code Here


          column = 0;
        }
        ppi++;
        continue;
      }
      ItemIdentifier item = itemStack.getItem();
      if(IItemSearch != null && !IItemSearch.itemSearched(item)) continue;
      ppi++;
     
      if(ppi <= items * page) continue;
      if(ppi > items * (page + 1)) continue;
View Full Code Here

    for (int i = 0; i < inventory.getSizeInventory() - 2; i++) {
      final ItemIdentifierStack stackInSlot = inventory.getIDStackInSlot(i);
      if (stackInSlot == null) {
        continue;
      }
      final ItemIdentifier itemInSlot = stackInSlot.getItem();
      for (int j = i + 1; j < inventory.getSizeInventory() - 2; j++) {
        final ItemIdentifierStack stackInOtherSlot = inventory.getIDStackInSlot(j);
        if (stackInOtherSlot == null) {
          continue;
        }
        if (itemInSlot.equals(stackInOtherSlot.getItem())) {
          stackInSlot.setStackSize(stackInSlot.getStackSize() + stackInOtherSlot.getStackSize());
          inventory.setInventorySlotContents(i,stackInSlot);
          inventory.clearInventorySlotContents(j);
        }
      }
View Full Code Here

    for (int i = 0; i < 9; i++) {
      final ItemIdentifierStack stackInSlot = inventory.getIDStackInSlot(i);
      if (stackInSlot == null) {
        continue;
      }
      final ItemIdentifier itemInSlot = stackInSlot.getItem();
      for (int j = i + 1; j < 9; j++) {
        final ItemIdentifierStack stackInOtherSlot = inventory.getIDStackInSlot(j);
        if (stackInOtherSlot == null) {
          continue;
        }
        if (itemInSlot.equals(stackInOtherSlot.getItem()) && flags[i] == flags[j]) {
          stackInSlot.setStackSize(stackInSlot.getStackSize() + stackInOtherSlot.getStackSize());
          inventory.clearInventorySlotContents(j);
          flags[j] = 0;
        }
      }
View Full Code Here

    boolean contentchanged = false;
    if(!itemsOnRoute.isEmpty()) { // don't check the inventory if you don't want anything
      for(int i=0; i<inv.getSizeInventory();i++) {
        ItemStack stack = inv.getStackInSlot(i);
        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);
View Full Code Here

  @Override
  public void addItem(ItemRoutingInformation info)
   
  {
    if(info.getItem() != null && info.getItem().getStackSize() >0 && info.destinationint >= 0) {
      ItemIdentifier insertedType = info.getItem().getItem();
      List<ItemRoutingInformation> entry = itemsOnRoute.get(insertedType);
      if(entry == null) {
        entry = new LinkedList<ItemRoutingInformation>(); // linked list as this is almost always very small, but experiences random removal
        itemsOnRoute.put(insertedType,entry);
      }
View Full Code Here

    }
  }

  private boolean handle(IInventoryUtil invUtil, int slot, List<CCSinkResponder> list) {
    if(list.isEmpty()) return false;
    ItemIdentifier ident = list.get(0).getStack().getItem();
    ItemStack stack = invUtil.getStackInSlot(slot);
    if(stack == null || !ItemIdentifier.get(stack).equals(ident)) return false;
    final IRouter source = this._service.getRouter();
    List<Triplet<Integer, Integer, CCSinkResponder>> posibilities = new ArrayList<Triplet<Integer, Integer, CCSinkResponder>>();
    for(CCSinkResponder sink:list) {
View Full Code Here

   
    for (int i = 0; i < targetUtil.getSizeInventory(); i++){
     
      ItemStack slot = targetUtil.getStackInSlot(i);
      if (slot == null) continue;
      ItemIdentifier slotitem = ItemIdentifier.get(slot);
      List<Integer> jamList = new LinkedList<Integer>();
      Pair<Integer, SinkReply> reply = _service.hasDestination(slotitem, true, jamList);
      if (reply == null) continue;

      int itemsleft = itemsToExtract();
      while(reply != null) {
        int count = Math.min(itemsleft, slot.stackSize);
        count = Math.min(count, slotitem.getMaxStackSize());
        if(reply.getValue2().maxNumberOfItems > 0) {
          count = Math.min(count, reply.getValue2().maxNumberOfItems);
        }

        while(!_service.useEnergy(neededEnergy() * count) && count > 0) {
View Full Code Here

      ItemStack item = matrix.getStackInSlot(i);
      if(item == null) {
        toUse[i] = -1;
        continue;
      }
      ItemIdentifier ident = ItemIdentifier.get(item);
      for(int j=0;j<inv.getSizeInventory();j++) {
        item = inv.getStackInSlot(j);
        if(item == null) continue;
        if(ident.equalsForCrafting(ItemIdentifier.get(item))) {
          if(item.stackSize > used[j]) {
            used[j]++;
            toUse[i] = j;
            continue outer;
          }
View Full Code Here

  protected int stacksToExtract() {
    return 1;
  }
 
  private int sendStack(ItemIdentifierStack stack, int maxCount, int destination, IAdditionalTargetInformation info) {
    ItemIdentifier item = stack.getItem();
   
    WorldUtil wUtil = new WorldUtil(getWorld(), getX(), getY(), getZ());
    for (AdjacentTile tile : wUtil.getAdjacentTileEntities(true)){
      if (!(tile.tile instanceof IInventory)) continue;
      if (SimpleServiceLocator.pipeInformaitonManager.isPipe(tile.tile)) continue;
     
      IInventoryUtil inv = getAdaptedInventoryUtil(tile);
      int available = inv.itemCount(item);
      if (available == 0) continue;
     
      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) {
        _orderManager.sendFailed();
        return 0;
      }
View Full Code Here

TOP

Related Classes of logisticspipes.utils.item.ItemIdentifier

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.