Package net.minecraft.inventory

Examples of net.minecraft.inventory.InventoryCrafting


    if (!doRemove) {
      inv = new InventoryCopy(robot);
    }

    InventoryCrafting invCraft = new InventoryCrafting(new Container() {

      @Override
      public boolean canInteractWith(EntityPlayer player) {
        // TODO Auto-generated method stub
        return false;
      }
    }, 3, 3);

    for (int i = 0; i < items.length; ++i) {
      Object tmp = items [i];

      if (tmp == null) {
        continue;
      }

      int qty = 0;
      ArrayStackFilter filter;

      if (tmp instanceof ItemStack) {
        ItemStack stack = (ItemStack) tmp;
        qty = stack.stackSize;
        filter = new ArrayStackFilter(stack);
      } else {
        ArrayList<ItemStack> stacks = (ArrayList<ItemStack>) tmp;
        qty = stacks.get(0).stackSize;
        filter = new ArrayStackFilter(stacks.toArray(new ItemStack[stacks.size()]));
      }

      for (IInvSlot s : InventoryIterator.getIterable(inv)) {
        if (filter.matches(s.getStackInSlot())) {
          ItemStack removed = s.decreaseStackInSlot(qty);

          qty = qty - removed.stackSize;

          if (invCraft.getStackInSlot(i) != null) {
            invCraft.getStackInSlot(i).stackSize += qty;
          } else {
            invCraft.setInventorySlotContents(i, removed);
          }

          invCraft.setInventorySlotContents(i, removed);

          if (removed.stackSize == 0) {
            break;
          }
        }
View Full Code Here

TOP

Related Classes of net.minecraft.inventory.InventoryCrafting

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.