Package forestry.core.utils

Examples of forestry.core.utils.PlainInventory


    private boolean locked;
    private World cachedWorld;
    private ItemStack cachedRecipeOutput;

    public Recipe(InventoryCrafting crafting) {
      this.matrix = new InventoryAdapter(new PlainInventory(crafting));
    }
View Full Code Here


   * @return
   */
  public static ItemStack[] removeItems(IInventory inv, int numItems) {
    if (inv instanceof ISpecialInventory)
      return ((ISpecialInventory) inv).extractItem(true, ForgeDirection.UNKNOWN, numItems);
    PlainInventory output = new PlainInventory(27, "temp");
    for (int i = 0; i < inv.getSizeInventory(); i++) {
      if (numItems <= 0)
        break;
      ItemStack slot = inv.getStackInSlot(i);
      if (slot == null)
        continue;
      ItemStack removed = inv.decrStackSize(i, numItems);
      numItems -= removed.stackSize;
      ItemStack remainder = moveItemStack(removed, output);
      if (remainder != null) {
        moveItemStack(remainder, inv);
        numItems += remainder.stackSize;
        break;
      }
    }

    List<ItemStack> list = new LinkedList<ItemStack>();
    for (ItemStack stack : output.getContents()) {
      if (stack != null)
        list.add(stack);
    }
    return list.toArray(new ItemStack[0]);
  }
View Full Code Here

TOP

Related Classes of forestry.core.utils.PlainInventory

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.