Program: 30668
Project: 30668
Buggy source:
public void updateCraftingLogic(IGrid grid,IEnergyGrid eg,CraftingGridCache cc){
  if (myLastLink != null) {
    if (myLastLink.isCanceled()) {
      myLastLink=null;
      cancel();
    }
  }
  if (isComplete) {
    if (inventory.getItemList().isEmpty())     return;
    storeItems();
    return;
  }
  waiting=false;
  if (waiting || tasks.isEmpty())   return;
  int remainingOperations=accelerator + 1 + 90;
  boolean didsomething=false;
  for (  Entry<ICraftingPatternDetails,TaskProgress> e : tasks.entrySet()) {
    if (e.getValue().value <= 0)     continue;
    ICraftingPatternDetails details=e.getKey();
    if (canCraft(details,details.getCondencedInputs())) {
      InventoryCrafting ic=null;
      for (      ICraftingMedium m : cc.getMediums(e.getKey())) {
        if (e.getValue().value <= 0)         continue;
        if (!m.isBusy()) {
          if (ic == null) {
            IAEItemStack[] input=details.getInputs();
            double sum=0;
            for (int x=0; x < input.length; x++) {
              if (input[x] != null)               sum+=input[x].getStackSize();
            }
            if (eg.extractAEPower(sum,Actionable.MODULATE,PowerMultiplier.CONFIG) < sum - 0.01)             continue;
            ic=new InventoryCrafting(new ContainerNull(),3,3);
            boolean found=false;
            for (int x=0; x < input.length; x++) {
              if (input[x] != null) {
                found=false;
                if (details.isCraftable()) {
                  for (                  IAEItemStack fuzz : inventory.getItemList().findFuzzy(input[x],FuzzyMode.IGNORE_ALL)) {
                    fuzz=fuzz.copy();
                    fuzz.setStackSize(input[x].getStackSize());
                    IAEItemStack ais=inventory.extractItems(fuzz,Actionable.MODULATE,machineSrc);
                    ItemStack is=ais == null ? null : ais.getItemStack();
                    if (is != null && details.isValidItemForSlot(x,is,getWorld())) {
                      postChange(AEItemStack.create(is),machineSrc);
                      ic.setInventorySlotContents(x,is);
                      found=true;
                      break;
                    }
                  }
                }
 else {
                  IAEItemStack ais=inventory.extractItems(input[x].copy(),Actionable.MODULATE,machineSrc);
                  ItemStack is=ais == null ? null : ais.getItemStack();
                  if (is != null) {
                    postChange(input[x],machineSrc);
                    ic.setInventorySlotContents(x,is);
                    found=true;
                    continue;
                  }
                }
                if (!found)                 break;
              }
            }
            if (!found) {
              for (int x=0; x < ic.getSizeInventory(); x++) {
                ItemStack is=ic.getStackInSlot(x);
                if (is != null)                 inventory.injectItems(AEItemStack.create(is),Actionable.MODULATE,machineSrc);
              }
              ic=null;
              break;
            }
          }
          if (m.pushPattern(details,ic)) {
            didsomething=true;
            remainingOperations--;
            for (            IAEItemStack out : details.getCondencedOutputs()) {
              postChange(out,machineSrc);
              waitingFor.add(out.copy());
            }
            if (details.isCraftable()) {
              FMLCommonHandler.instance().firePlayerCraftingEvent(Platform.getPlayer((WorldServer)getWorld()),details.getOutput(ic,getWorld()),ic);
              for (int x=0; x < ic.getSizeInventory(); x++) {
                ItemStack output=Platform.getContainerItem(ic.getStackInSlot(x));
                if (output != null) {
                  IAEItemStack cItem=AEItemStack.create(output);
                  postChange(cItem,machineSrc);
                  waitingFor.add(cItem);
                }
              }
            }
            ic=null;
            markDirty();
            e.getValue().value--;
            if (e.getValue().value <= 0)             continue;
            if (remainingOperations == 0)             return;
          }
        }
      }
      if (ic != null) {
        for (int x=0; x < ic.getSizeInventory(); x++) {
          ItemStack is=ic.getStackInSlot(x);
          if (is != null) {
            inventory.injectItems(AEItemStack.create(is),Actionable.MODULATE,machineSrc);
          }
        }
      }
    }
  }
  if (remainingOperations > 0 && didsomething == false)   waiting=true;
}

Fixed version (ground truth):
public void updateCraftingLogic(IGrid grid,IEnergyGrid eg,CraftingGridCache cc){
  if (!getCore().isActive())   return;
  if (myLastLink != null) {
    if (myLastLink.isCanceled()) {
      myLastLink=null;
      cancel();
    }
  }
  if (isComplete) {
    if (inventory.getItemList().isEmpty())     return;
    storeItems();
    return;
  }
  waiting=false;
  if (waiting || tasks.isEmpty())   return;
  int remainingOperations=accelerator + 1 + 90;
  boolean didsomething=false;
  Iterator<Entry<ICraftingPatternDetails,TaskProgress>> i=tasks.entrySet().iterator();
  while (i.hasNext()) {
    Entry<ICraftingPatternDetails,TaskProgress> e=i.next();
    if (e.getValue().value <= 0) {
      i.remove();
      continue;
    }
    ICraftingPatternDetails details=e.getKey();
    if (canCraft(details,details.getCondencedInputs())) {
      InventoryCrafting ic=null;
      for (      ICraftingMedium m : cc.getMediums(e.getKey())) {
        if (e.getValue().value <= 0)         continue;
        if (!m.isBusy()) {
          if (ic == null) {
            IAEItemStack[] input=details.getInputs();
            double sum=0;
            for (int x=0; x < input.length; x++) {
              if (input[x] != null)               sum+=input[x].getStackSize();
            }
            if (eg.extractAEPower(sum,Actionable.MODULATE,PowerMultiplier.CONFIG) < sum - 0.01)             continue;
            ic=new InventoryCrafting(new ContainerNull(),3,3);
            boolean found=false;
            for (int x=0; x < input.length; x++) {
              if (input[x] != null) {
                found=false;
                if (details.isCraftable()) {
                  for (                  IAEItemStack fuzz : inventory.getItemList().findFuzzy(input[x],FuzzyMode.IGNORE_ALL)) {
                    fuzz=fuzz.copy();
                    fuzz.setStackSize(input[x].getStackSize());
                    IAEItemStack ais=inventory.extractItems(fuzz,Actionable.MODULATE,machineSrc);
                    ItemStack is=ais == null ? null : ais.getItemStack();
                    if (is != null && details.isValidItemForSlot(x,is,getWorld())) {
                      postChange(AEItemStack.create(is),machineSrc);
                      ic.setInventorySlotContents(x,is);
                      found=true;
                      break;
                    }
                  }
                }
 else {
                  IAEItemStack ais=inventory.extractItems(input[x].copy(),Actionable.MODULATE,machineSrc);
                  ItemStack is=ais == null ? null : ais.getItemStack();
                  if (is != null) {
                    postChange(input[x],machineSrc);
                    ic.setInventorySlotContents(x,is);
                    found=true;
                    continue;
                  }
                }
                if (!found)                 break;
              }
            }
            if (!found) {
              for (int x=0; x < ic.getSizeInventory(); x++) {
                ItemStack is=ic.getStackInSlot(x);
                if (is != null)                 inventory.injectItems(AEItemStack.create(is),Actionable.MODULATE,machineSrc);
              }
              ic=null;
              break;
            }
          }
          if (m.pushPattern(details,ic)) {
            didsomething=true;
            remainingOperations--;
            for (            IAEItemStack out : details.getCondencedOutputs()) {
              postChange(out,machineSrc);
              waitingFor.add(out.copy());
            }
            if (details.isCraftable()) {
              FMLCommonHandler.instance().firePlayerCraftingEvent(Platform.getPlayer((WorldServer)getWorld()),details.getOutput(ic,getWorld()),ic);
              for (int x=0; x < ic.getSizeInventory(); x++) {
                ItemStack output=Platform.getContainerItem(ic.getStackInSlot(x));
                if (output != null) {
                  IAEItemStack cItem=AEItemStack.create(output);
                  postChange(cItem,machineSrc);
                  waitingFor.add(cItem);
                }
              }
            }
            ic=null;
            markDirty();
            e.getValue().value--;
            if (e.getValue().value <= 0)             continue;
            if (remainingOperations == 0)             return;
          }
        }
      }
      if (ic != null) {
        for (int x=0; x < ic.getSizeInventory(); x++) {
          ItemStack is=ic.getStackInSlot(x);
          if (is != null) {
            inventory.injectItems(AEItemStack.create(is),Actionable.MODULATE,machineSrc);
          }
        }
      }
    }
  }
  if (remainingOperations > 0 && didsomething == false)   waiting=true;
}