Package logisticspipes.blocks.crafting

Examples of logisticspipes.blocks.crafting.AutoCraftingInventory


  }
 
  public void cacheRecipe() {
    cache = null;
    resultInv.clearInventorySlotContents(0);
    AutoCraftingInventory craftInv = new AutoCraftingInventory(null);//TODO
    for(int i=0; i<9;i++) {
      craftInv.setInventorySlotContents(i, matrix.getStackInSlot(i));
    }
    for(IRecipe r : CraftingUtil.getRecipeList()) {
      if(r.matches(craftInv, getWorld())) {
        cache = r;
        resultInv.setInventorySlotContents(0, r.getCraftingResult(craftInv));
View Full Code Here


        }
      }
      //Not enough material
      return null;
    }
    AutoCraftingInventory crafter = new AutoCraftingInventory(null);//TODO
    for(int i=0;i<9;i++) {
      int j = toUse[i];
      if(j != -1) crafter.setInventorySlotContents(i, inv.getStackInSlot(j));
    }
    if(!cache.matches(crafter, getWorld())) return null; //Fix MystCraft
    ItemStack result = cache.getCraftingResult(crafter);
    if(result == null) return null;
    if(!resultInv.getIDStackInSlot(0).getItem().equalsWithoutNBT(ItemIdentifier.get(result))) return null;
    crafter = new AutoCraftingInventory(null);//TODO
    for(int i=0;i<9;i++) {
      int j = toUse[i];
      if(j != -1) crafter.setInventorySlotContents(i, inv.decrStackSize(j, 1));
    }
    result = cache.getCraftingResult(crafter);
    if(fake == null) {
      fake = MainProxy.getFakePlayer(this.container);
    }
    result = result.copy();
    SlotCrafting craftingSlot = new SlotCrafting(fake, crafter, resultInv, 0, 0, 0);
    craftingSlot.onPickupFromSlot(fake, result);
    for(int i=0;i<9;i++) {
      ItemStack left = crafter.getStackInSlot(i);
      crafter.setInventorySlotContents(i, null);
      if(left != null) {
        left.stackSize = inv.addCompressed(left, false);
        if(left.stackSize > 0) {
          ItemIdentifierInventory.dropItems(getWorld(), left, getX(), getY(), getZ());
        }
View Full Code Here

TOP

Related Classes of logisticspipes.blocks.crafting.AutoCraftingInventory

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.