@Override
  public boolean checkRecipe(ItemStack aStack) {
    ArrayList<ItemStack> tInputList = getStoredInputs();
    for (ItemStack tInput : tInputList) {
      long tVoltage = getMaxInputVoltage();
      byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));

      GT_Recipe tRecipe =
          GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe(
              getBaseMetaTileEntity(),
              false,
              gregtech.api.enums.GT_Values.V[tTier],
              null,
              new ItemStack[] {tInput});
      if (tRecipe != null) {
        if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[] {tInput})) {
          this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
          this.mEfficiencyIncrease = 10000;
          if (tRecipe.mEUt <= 16) {
            this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
            this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
          } else {
            this.mEUt = tRecipe.mEUt;
            this.mMaxProgresstime = tRecipe.mDuration;
            while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
              this.mEUt *= 4;
              this.mMaxProgresstime /= 2;
            }
          }
          if (this.mEUt > 0) {
            this.mEUt = (-this.mEUt);
          }
          this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
          this.mOutputItems = new ItemStack[] {tRecipe.getOutput(0)};
          updateSlots();
          return true;
        }
      }
    }
    return false;
  }
 public int checkRecipe() {
   GT_Recipe tRecipe =
       GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.findRecipe(
           getBaseMetaTileEntity(),
           false,
           gregtech.api.enums.GT_Values.V[2],
           null,
           getAllInputs());
   if ((tRecipe != null)
       && (canOutput(tRecipe.mOutputs))
       && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) {
     this.mOutputItems[0] = tRecipe.getOutput(0);
     if (tRecipe.mEUt <= 16) {
       this.mEUt = (tRecipe.mEUt * 3);
       this.mMaxProgresstime = tRecipe.mDuration;
     } else {
       this.mEUt = (tRecipe.mEUt * 3);
       this.mMaxProgresstime = tRecipe.mDuration;
     }
     return 2;
   }
   return 0;
 }
  public boolean checkRecipe(ItemStack aStack) {
    if (!isCorrectMachinePart(mInventory[1])) {
      return false;
    }
    GT_Recipe.GT_Recipe_Map map = getRecipeMap();
    if (map == null) {
      return false;
    }
    ArrayList<ItemStack> tInputList = getStoredInputs();
    int tTier = 0;
    if (mInventory[1].getUnlocalizedName().endsWith("1")) {
      tTier = 1;
    }
    if (mInventory[1].getUnlocalizedName().endsWith("2")) {
      tTier = 2;
    }
    if (mInventory[1].getUnlocalizedName().endsWith("3")) {
      tTier = 3;
    }
    if (mInventory[1].getUnlocalizedName().endsWith("4")) {
      tTier = 4;
    }
    if (mInventory[1].getUnlocalizedName().endsWith("5")) {
      tTier = 5;
    }
    for (int i = 0; i < tInputList.size() - 1; i++) {
      for (int j = i + 1; j < tInputList.size(); j++) {
        if (GT_Utility.areStacksEqual(
            (ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) {
          if (((ItemStack) tInputList.get(i)).stackSize
              >= ((ItemStack) tInputList.get(j)).stackSize) {
            tInputList.remove(j--);
          } else {
            tInputList.remove(i--);
            break;
          }
        }
      }
    }
    ItemStack[] tInputs =
        (ItemStack[])
            Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);

    ArrayList<FluidStack> tFluidList = getStoredFluids();
    for (int i = 0; i < tFluidList.size() - 1; i++) {
      for (int j = i + 1; j < tFluidList.size(); j++) {
        if (GT_Utility.areFluidsEqual(
            (FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) {
          if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) {
            tFluidList.remove(j--);
          } else {
            tFluidList.remove(i--);
            break;
          }
        }
      }
    }
    FluidStack[] tFluids =
        (FluidStack[])
            Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
    if (tInputList.size() > 0 || tFluids.length > 0) {
      GT_Recipe tRecipe =
          map.findRecipe(
              getBaseMetaTileEntity(),
              mLastRecipe,
              false,
              gregtech.api.enums.GT_Values.V[tTier],
              tFluids,
              tInputs);
      if (tRecipe != null) {
        mLastRecipe = tRecipe;
        this.mEUt = 0;
        this.mOutputItems = null;
        this.mOutputFluids = null;
        this.mMaxProgresstime = tRecipe.mDuration;
        int machines = Math.min(16, mInventory[1].stackSize);
        this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
        this.mEfficiencyIncrease = 10000;
        int i = 0;
        for (; i < machines; i++) {
          if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) break;
        }
        //										System.out.println("recipe:"+i+" "+tRecipe.mDuration+" "+tRecipe.mEUt);
        //										if(tRecipe.mOutputs.length>0){
        //											System.out.println(tRecipe.mOutputs[0].getUnlocalizedName());
        //										}
        //										if(tRecipe.mFluidOutputs.length>0){
        //											System.out.println(tRecipe.mFluidOutputs[0].getUnlocalizedName());
        //										}
        if (tRecipe.mEUt <= 16) {
          this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
          this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
        } else {
          this.mEUt = tRecipe.mEUt;
          this.mMaxProgresstime = tRecipe.mDuration;
          while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
            this.mEUt *= 4;
            this.mMaxProgresstime /= 2;
          }
        }
        this.mEUt *= i;
        if (this.mEUt > 0) {
          this.mEUt = (-this.mEUt);
        }
        ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length];
        for (int h = 0; h < tRecipe.mOutputs.length; h++) {
          tOut[h] = tRecipe.getOutput(h).copy();
          tOut[h].stackSize = 0;
        }
        FluidStack tFOut = null;
        if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy();
        for (int f = 0; f < tOut.length; f++) {
          if (tRecipe.mOutputs[f] != null && tOut[f] != null) {
            for (int g = 0; g < i; g++) {
              if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f))
                tOut[f].stackSize += tRecipe.mOutputs[f].stackSize;
            }
          }
        }
        if (tFOut != null) {
          int tSize = tFOut.amount;
          tFOut.amount = tSize * i;
        }
        this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
        this.mOutputItems = tOut;
        this.mOutputFluids = new FluidStack[] {tFOut};
        //										System.out.println("ArrayOut"+mOutputItems.length+" "+mOutputFluids.length+"
        // "+(mOutputItems.length>0?mOutputItems[0].getUnlocalizedName():"")+"
        // "+(mOutputFluids.length>0?mOutputFluids[0].getUnlocalizedName():" "));
        updateSlots();
        return true;
      }
    }
    return false;
  }