diff options
author | huajijam <strhuaji@gmail.com> | 2019-01-30 19:01:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-30 19:01:07 +0800 |
commit | d0e3b95db387194a5da4ff71d743a3ede6b42f5e (patch) | |
tree | da5c64c420de4242ab1e23cbb74d8294843228b0 /src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java | |
parent | f32773a4c5664c48b3ea832e22da9dda68120c38 (diff) | |
parent | 241df1134f16c6c9c54b198db97279d697de8c77 (diff) | |
download | GT5-Unofficial-d0e3b95db387194a5da4ff71d743a3ede6b42f5e.tar.gz GT5-Unofficial-d0e3b95db387194a5da4ff71d743a3ede6b42f5e.tar.bz2 GT5-Unofficial-d0e3b95db387194a5da4ff71d743a3ede6b42f5e.zip |
update
update
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 1d99b1c2d7..50e9f8c3d6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -6,8 +6,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; -import net.minecraft.item.ItemStack; - import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -16,7 +14,6 @@ import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; @@ -25,7 +22,9 @@ import gtPlusPlus.core.util.data.ArrayUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.recipes.machines.RECIPEHANDLER_MatterFabricator; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -442,19 +441,16 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { @Override public boolean addCyclotronRecipe(ItemStack aInputs, FluidStack aFluidInput, ItemStack[] aOutputs, FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt, int aSpecialValue) { - return addCyclotronRecipe(new ItemStack[] {aInputs}, aFluidInput, aOutputs[0], aFluidOutput, aChances, aDuration, aEUt, aSpecialValue); + return addCyclotronRecipe(new ItemStack[] {aInputs}, aFluidInput, aOutputs, aFluidOutput, aChances, aDuration, aEUt, aSpecialValue); } @Override - public boolean addCyclotronRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, + public boolean addCyclotronRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack[] aOutput, FluidStack aFluidOutput, int[] aChances, int aDuration, int aEUt, int aSpecialValue) { - if (aOutput == null) { - return false; - } - if ((aDuration = GregTech_API.sRecipeFile.get("cyclotron", aOutput, aDuration)) <= 0) { + if (aOutput == null || aOutput.length < 1 || !ItemUtils.checkForInvalidItems(aOutput)) { return false; } - if (Recipe_GT.Gregtech_Recipe_Map.sCyclotronRecipes.addRecipe(true, aInputs, new ItemStack[] { aOutput }, + if (Recipe_GT.Gregtech_Recipe_Map.sCyclotronRecipes.addRecipe(true, aInputs, aOutput, null, aChances, new FluidStack[] { aFluidInput }, new FluidStack[] { aFluidOutput }, Math.max(1, aDuration), Math.max(1, aEUt), aSpecialValue) != null) { return true; @@ -913,6 +909,29 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } + /** + * Lets me add recipes for GT 5.08 & 5.09, since someone broke the method headers. + */ + @Override + public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput) { + Method m = StaticFields59.mAddFurnaceRecipe; + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + try { + return (boolean) m.invoke(null, aDust, aOutput); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + return false; + } + } + else { + try { + return (boolean) m.invoke(null, aDust, aOutput, true); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + return false; + } + } + } + + |