diff options
| author | miozune <miozune@gmail.com> | 2023-02-05 19:28:32 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-05 11:28:32 +0100 |
| commit | 93d1e6e1351937b1a328b537e3cdc3446b351cc3 (patch) | |
| tree | 0da501ced2dfe9e2561e5cf9e4e0bb339211967d /src/main/java/gtPlusPlus/core | |
| parent | bb9da48b9975cb27e3b7c538bff2853a34b36fcd (diff) | |
| download | GT5-Unofficial-93d1e6e1351937b1a328b537e3cdc3446b351cc3.tar.gz GT5-Unofficial-93d1e6e1351937b1a328b537e3cdc3446b351cc3.tar.bz2 GT5-Unofficial-93d1e6e1351937b1a328b537e3cdc3446b351cc3.zip | |
Cleanup recipe adder (#530)
* Cleanup recipe adder
* Remove redundant public
* consistent returns
Diffstat (limited to 'src/main/java/gtPlusPlus/core')
| -rw-r--r-- | src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java | 21 | ||||
| -rw-r--r-- | src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java | 138 |
2 files changed, 1 insertions, 158 deletions
diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 3bf145f0b3..6912d3508e 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -315,24 +315,6 @@ public class RECIPES_GREGTECH { } private static void fusionRecipes() { - - /** - * Adds a Fusion reactor Recipe - * - * @param aInput1 = first Input (not null, and respects StackSize) - * @param aInput2 = second Input (not null, and respects StackSize) - * @param aOutput = Output of the Fusion (can be null, and respects StackSize) - * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) - * @param aFusionEnergyPerTick = The EU generated per Tick (can even be negative!) - * @param aEnergyNeededForStartingFusion = EU needed for heating the Reactor up (must be >= 0) - */ - - // Hydrogen Plasma - /* - * CORE.RA.addFusionReactorRecipe( Particle.getIon("Hydrogen", 0), Particle.getIon("Hydrogen", 0), - * Materials.Hydrogen.getPlasma(1), 5000, 16, 4096, 40000000); - */ - // Hypogen Creation GT_Values.RA.addFusionReactorRecipe( ELEMENT.STANDALONE.DRAGON_METAL.getFluidStack(144), @@ -1476,12 +1458,9 @@ public class RECIPES_GREGTECH { ThermalFuel.addSteamTurbineFuel(FluidUtils.getFluidStack("steam", 1024)); - // CORE.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketRocket_fuel", - // 0, 1), null, 112, 0); GT_Values.RA.addFuel(ItemUtils.getSimpleStack(Items.lava_bucket), null, 32, 2); GT_Values.RA.addFuel(ItemUtils.getIC2Cell(2), null, 32, 2); GT_Values.RA.addFuel(ItemUtils.getIC2Cell(11), null, 24, 2); - // System.exit(1); } private static void extractorRecipes() { diff --git a/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java b/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java index 3bd507fb38..d08f98259d 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java @@ -1,18 +1,13 @@ package gtPlusPlus.core.util.reflect; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import gregtech.api.enums.GT_Values; -import gregtech.api.interfaces.internal.IGT_RecipeAdder; import gregtech.api.util.GT_Recipe; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.FluidUtils; public final class AddGregtechRecipe { @@ -73,139 +68,8 @@ public final class AddGregtechRecipe { int TIME = timeInSeconds * 20; int TIMEPYRO = TIME + (TIME / 5); // Even though it says coke and pyrolyse, ICO recipes are imported from pyrolyse by #importPyroRecipe - PyrolyseOven(input1, inputFluid1, circuitNumber, output1, outputFluid1, TIMEPYRO, euTick); - - return false; - } - - public static boolean PyrolyseOven(final ItemStack p0, final FluidStack p1, final int p2, final ItemStack p3, - final FluidStack p4, final int p5, final int p6) { - - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null) { - Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); - Method addRecipe = classRA.getMethod( - "addPyrolyseRecipe", - ItemStack.class, - FluidStack.class, - int.class, - ItemStack.class, - FluidStack.class, - int.class, - int.class); - if (addRecipe != null) { - return (boolean) addRecipe.invoke(IGT_RecipeAdder, p0, p1, p2, p3, p4, p5, p6); - } - } - } catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - return false; - } - return false; - } - - public static boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, - FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { - /* - * try { IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; if (IGT_RecipeAdder != null){ Class<? extends - * IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); for(Method current : classRA.getDeclaredMethods()){ - * //Utils.LOG_INFO("-----------------------------------------------"); - * ////Utils.LOG_INFO("Found method: "+current.getName()); //Utils.LOG_INFO("With Parameters: "); - * //Utils.LOG_INFO("==============================================="); for (Class<?> P : - * current.getParameterTypes()){ //Utils.LOG_INFO(""+P.getName()); //Utils.LOG_INFO(""+P.getClass().getName()); - * } //Utils.LOG_INFO("==============================================="); } try { Method testRA = - * GT_Values.RA.getClass().getMethod("addAssemblylineRecipe", GT_Values.RA.getClass(), aResearchItem.getClass(), - * int.class, aInputs.getClass(), aFluidInputs.getClass(), aOutput.getClass(), int.class, int.class); - * testRA.invoke(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); } catch - * (Throwable masndj){ masndj.printStackTrace(); } Method addRecipe = classRA.getDeclaredMethod( - * "addAssemblylineRecipe", ItemStack.class, int.class, ItemStack.class, FluidStack.class, ItemStack.class, - * int.class, int.class); if (addRecipe != null){ return (boolean) addRecipe.invoke(aResearchItem, - * aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); } } } catch (SecurityException | - * NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - * Utils.LOG_INFO("[Assembly Line] - Failed to add recipe, due to GT not being .09 branch. Research: " - * +aResearchItem.getDisplayName()+" | Result: "+aOutput.getDisplayName()); e.printStackTrace(); return false; } - * Utils.LOG_INFO("[Assembly Line] - Failed to add recipe. Research: "+aResearchItem.getDisplayName() - * +" | Result: "+aOutput.getDisplayName()); - */ return false; - } - - public static boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, - int aDuration, int aEUt) { - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null) { - Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); - Method addRecipe = classRA.getMethod( - "addCircuitAssemblerRecipe", - ItemStack.class, - FluidStack.class, - ItemStack.class, - int.class, - int.class); - if (addRecipe != null) { - if (aFluidInput.isFluidEqual(FluidUtils.getFluidStack("molten.tin", 1))) { - boolean[] didAdd = new boolean[3]; - FluidStack moltenMetal = FluidUtils.getFluidStack("molten.tin", 144); - // Tin - didAdd[0] = (boolean) addRecipe - .invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); - moltenMetal = FluidUtils.getFluidStack("molten.lead", 144); - // Lead - didAdd[1] = (boolean) addRecipe - .invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); - moltenMetal = FluidUtils.getFluidStack("molten.solderingalloy", 144 / 2); - // Soldering Alloy - didAdd[2] = (boolean) addRecipe - .invoke(IGT_RecipeAdder, aInputs, moltenMetal, aOutput, aDuration, aEUt); + GT_Values.RA.addPyrolyseRecipe(input1, inputFluid1, circuitNumber, output1, outputFluid1, TIMEPYRO, euTick); - if (didAdd[0] && didAdd[1] && didAdd[2]) { - return true; - } else { - return false; - } - } else { - return (boolean) addRecipe - .invoke(IGT_RecipeAdder, aInputs, aFluidInput, aOutput, aDuration, aEUt); - } - } - } - } catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - return false; - } return false; } - - public static boolean addChemicalRecipeForBasicMachineOnly(final ItemStack p0, final ItemStack p1, - final FluidStack p2, final FluidStack p3, final ItemStack p4, final ItemStack p5, final int p6, - final int p7) { - - try { - IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; - if (IGT_RecipeAdder != null) { - Class<? extends IGT_RecipeAdder> classRA = IGT_RecipeAdder.getClass(); - // final ItemStack p0, final ItemStack p1, final FluidStack p2, final FluidStack p3, final ItemStack - // p4, final ItemStack p5, final int p6, final int p7 - Method addRecipe = classRA.getMethod( - "addChemicalRecipeForBasicMachineOnly", - ItemStack.class, - ItemStack.class, - FluidStack.class, - FluidStack.class, - ItemStack.class, - ItemStack.class, - int.class, - int.class); - if (addRecipe != null) { - return (boolean) addRecipe.invoke(IGT_RecipeAdder, p0, p1, p2, p3, p4, p5, p6, p7); - } - } - } catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - - } - - return GT_Values.RA.addChemicalRecipe(p0, p1, p2, p3, p4, p6); - } } |
