Examples of ITargetSlotInformation


Examples of logisticspipes.interfaces.routing.ITargetSlotInformation

        }
        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;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.