Package logisticspipes.pipes.upgrades

Examples of logisticspipes.pipes.upgrades.UpgradeManager


    return SimpleServiceLocator.inventoryUtilFactory.getHidingInventoryUtil(inv, this.getPointedOrientation().getOpposite(), false, false, 0, 0);
  }

  @Override
  public IInventoryUtil getSneakyInventory(boolean forExtraction) {
    UpgradeManager manager = getUpgradeManager();
    ForgeDirection insertion = this.getPointedOrientation().getOpposite();
    if(manager.hasSneakyUpgrade()) {
      insertion = manager.getSneakyOrientation();
    }
    return getSneakyInventory(insertion, forExtraction);
  }
View Full Code Here


          if(routed.getTransportMode() != TransportMode.Active && !getPipe().getTransportLayer().stillWantItem(routed)) {
            reverseItem(arrivingItem);
            return;
          }
        }
        UpgradeManager manager = getPipe().getUpgradeManager();
        boolean tookSome = false;
        if(arrivingItem.getAdditionalTargetInformation() instanceof ITargetSlotInformation) {

          ITargetSlotInformation information = (ITargetSlotInformation) arrivingItem.getAdditionalTargetInformation();
          IInventory inv = (IInventory)tile;
          if(inv instanceof ISidedInventory) inv = new SidedInventoryMinecraftAdapter((ISidedInventory)inv, ForgeDirection.UNKNOWN, false);
          IInventoryUtil util = SimpleServiceLocator.inventoryUtilFactory.getInventoryUtil(inv);
          if(util instanceof ISpecialInsertion) {
            int slot = information.getTargetSlot();
            int amount = information.getAmount();
            if(util.getSizeInventory() > slot) {
              ItemStack content = util.getStackInSlot(slot);
              ItemStack toAdd = arrivingItem.getItemIdentifierStack().makeNormalStack();
              toAdd.stackSize = Math.min(toAdd.stackSize, Math.max(0, amount - (content != null ? content.stackSize : 0)));
              if(toAdd.stackSize > 0) {
                if(util.getSizeInventory() > slot) {
                  int added = ((ISpecialInsertion)util).addToSlot(toAdd, slot);
                  arrivingItem.getItemIdentifierStack().lowerStackSize(added);
                  if(added > 0) {
                    tookSome = true;
                  }
                }
              }
            }
            if(information.isLimited()) {
              if(arrivingItem.getItemIdentifierStack().getStackSize() > 0) {
                reverseItem(arrivingItem);
              }
              return;
            }
          }
        }
        // sneaky insertion
        if(!manager.hasCombinedSneakyUpgrade()) {
          ForgeDirection insertion = arrivingItem.output.getOpposite();
          if(manager.hasSneakyUpgrade()) {
            insertion = manager.getSneakyOrientation();
          }
          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.
          }
        } 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);
           
View Full Code Here

TOP

Related Classes of logisticspipes.pipes.upgrades.UpgradeManager

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.