Package logisticspipes.utils.item

Examples of logisticspipes.utils.item.ItemIdentifierStack


    }
    int[] toUse = new int[9];
    int[] used = new int[inv.getSizeInventory()];
outer:
    for(int i=0;i<9;i++) {
      ItemIdentifierStack item = matrix.getIDStackInSlot(i);
      if(item == null) {
        toUse[i] = -1;
        continue;
      }
      ItemIdentifier ident = item.getItem();
      for(int j=0;j<inv.getSizeInventory();j++) {
        item = inv.getIDStackInSlot(j);
        if(item == null) continue;
        if(isFuzzy ? (testFuzzy(ident, item, i)) : ident.equalsForCrafting(item.getItem())) {
          if(item.getStackSize() > used[j]) {
            used[j]++;
            toUse[i] = j;
            continue outer;
          }
        }
View Full Code Here


  public void closeInventory() {}

  @Override
  public boolean isItemValidForSlot(int i, ItemStack itemstack) {
    if(i < 9 && i >= 0) {
      ItemIdentifierStack stack = matrix.getIDStackInSlot(i);
      if(stack != null && itemstack != null) {
        return stack.getItem().equalsWithoutNBT(ItemIdentifier.get(itemstack));
      }
    }
    return true;
  }
View Full Code Here

      inventory.setInventorySlotContents(i, newStack);
    }

    // Compact
    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

  public boolean importRecipe(TileEntity tile, ItemIdentifierInventory inventory) {
    if (!(tile instanceof LogisticsCraftingTableTileEntity))
      return false;

    LogisticsCraftingTableTileEntity bench = (LogisticsCraftingTableTileEntity) tile;
    ItemIdentifierStack result = bench.resultInv.getIDStackInSlot(0);
   
    if (result == null)
      return false;

    inventory.setInventorySlotContents(9, result);
View Full Code Here

    }
   
    //compact with fuzzy flags
   
    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;
        }
      }
      inventory.setInventorySlotContents(i,stackInSlot);
View Full Code Here

    ItemStack resultstack = tile.getTargetForTaget();
    if(resultstack == null) {
      resultstack = tile.getTagetForRecipe(false);
    }
    if(resultstack != null) {
      ItemIdentifierStack iis = ItemIdentifier.get(resultstack).makeStack(0);
      List<ItemIdentifierStack> iisl = new LinkedList<ItemIdentifierStack>();
      iisl.add(iis);
      BasicGuiHelper.renderItemIdentifierStackListIntoGui(iisl, null, 0, guiLeft + 141, guiTop + 47, 1, 1, 18, 18, mc, false, false);
    }
    mc.renderEngine.bindTexture(TEXTURE);
View Full Code Here

  public ItemIdentifierStack readItemIdentifierStack() throws IOException {
    int itemID = this.readInt();
    int stacksize = this.readInt();
    int damage = this.readInt();
    NBTTagCompound tag = this.readNBTTagCompound();
    return new ItemIdentifierStack(ItemIdentifier.get(Item.getItemById(itemID), damage, tag), stacksize);
  }
View Full Code Here

    }
    return list;
  }

  public IOrderInfoProvider readOrder() throws IOException {
    ItemIdentifierStack stack = this.readItemIdentifierStack();
    int routerId = this.readInt();
    boolean isFinished = this.readBoolean();
    boolean inProgress = this.readBoolean();
    RequestType type = this.readEnum(RequestType.class);
    List<Float> list = this.readList(new IReadListObject<Float>() {
View Full Code Here

          ILegacyActiveModule y = (ILegacyActiveModule)x;
          y.onBlockRemoval();
        }
      }
      for(int i=0;i<_moduleInventory.getSizeInventory();i++) {
        ItemIdentifierStack ms = _moduleInventory.getIDStackInSlot(i);
        if(ms != null) {
          ItemStack s = ms.makeNormalStack();
          ItemModuleInformationManager.saveInfotmation(s, this.getLogisticsModule().getSubModule(i));
          _moduleInventory.setInventorySlotContents(i, s);
        }
      }
      _moduleInventory.dropContents(this.getWorld(), getX(), getY(), getZ());
View Full Code Here

  public final LinkedList<LogisticsOrder> _extras = new LinkedList<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

TOP

Related Classes of logisticspipes.utils.item.ItemIdentifierStack

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.