diff options
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Recipe.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 225f316142..eedac317d9 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -9,6 +9,7 @@ import gregtech.api.objects.GT_FluidStack; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; import gregtech.api.objects.MaterialStack; +import gregtech.common.items.GT_IntegratedCircuit_Item; import gregtech.nei.GT_NEI_DefaultHandler.FixedPositionedStack; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -159,7 +160,16 @@ public class GT_Recipe implements Comparable<GT_Recipe> { mFluidInputs = aFluidInputs; mFluidOutputs = aFluidOutputs; mDuration = aDuration; - mSpecialValue = aSpecialValue; + if (aSpecialValue == 0) { + for (ItemStack input : mInputs) { + if (input != null && input.getItem() instanceof GT_IntegratedCircuit_Item && input.getItemDamage() == 0) { + mSpecialValue = -400; + } + } + } else { + mSpecialValue = aSpecialValue; + } + mEUt = aEUt; // checkCellBalance(); @@ -743,23 +753,35 @@ public class GT_Recipe implements Comparable<GT_Recipe> { return findRecipe(aTileEntity, null, aNotUnificated, aVoltage, aFluids, null, aInputs); } + public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { + return findRecipe(aTileEntity, null, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, null, aInputs); + } + public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { return findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, null, aInputs); } + public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack... aInputs) { + return findRecipe(aTileEntity, aRecipe, aNotUnificated, aDontCheckStackSizes, aVoltage, aFluids, null, aInputs); + } + + public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + return findRecipe(aTileEntity, aRecipe, aNotUnificated, true, aVoltage, aFluids, aSpecialSlot, aInputs); + } /** * finds a Recipe matching the aFluid and ItemStack Inputs. * * @param aTileEntity an Object representing the current coordinates of the executing Block/Entity/Whatever. This may be null, especially during Startup. * @param aRecipe in case this is != null it will try to use this Recipe first when looking things up. * @param aNotUnificated if this is T the Recipe searcher will unificate the ItemStack Inputs + * @param aDontCheckStackSizes if set to false will only return recipes that can be executed at least once with the provided input * @param aVoltage Voltage of the Machine or Long.MAX_VALUE if it has no Voltage * @param aFluids the Fluid Inputs * @param aSpecialSlot the content of the Special Slot, the regular Manager doesn't do anything with this, but some custom ones do. * @param aInputs the Item Inputs * @return the Recipe it has found or null for no matching Recipe */ - public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { + public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, boolean aDontCheckStackSizes, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { // No Recipes? Well, nothing to be found then. if (mRecipeList.isEmpty()) return null; @@ -785,7 +807,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { // Check the Recipe which has been used last time in order to not have to search for it again, if possible. if (aRecipe != null) - if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. @@ -794,11 +816,11 @@ public class GT_Recipe implements Comparable<GT_Recipe> { Collection<GT_Recipe> tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; } @@ -808,7 +830,7 @@ public class GT_Recipe implements Comparable<GT_Recipe> { Collection<GT_Recipe> tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; } |