aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-08-08 07:52:02 +1000
committerAlkalus <draknyte1@hotmail.com>2017-08-08 07:52:02 +1000
commit78170f6176af2b595e7feb8acf4ed390babeb088 (patch)
treeeeb4db12ebf69d80dcbdcb29d32d4b7b702774dd /src
parent137eb049e600788b8a8e050fd393980b6514e51b (diff)
downloadGT5-Unofficial-78170f6176af2b595e7feb8acf4ed390babeb088.tar.gz
GT5-Unofficial-78170f6176af2b595e7feb8acf4ed390babeb088.tar.bz2
GT5-Unofficial-78170f6176af2b595e7feb8acf4ed390babeb088.zip
+ Added a reflection function to use the circuit assembler when GT 5.09 is loaded.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java90
1 files changed, 83 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java
index 41aa3468f7..77889b4267 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java
@@ -6,12 +6,13 @@ import java.lang.reflect.Method;
import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.internal.IGT_RecipeAdder;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.fluid.FluidUtils;
import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public final class AddGregtechRecipe {
-
+
public static boolean addCokeAndPyrolyseRecipes(
ItemStack input1, int circuitNumber,
FluidStack inputFluid1,
@@ -39,13 +40,13 @@ public final class AddGregtechRecipe {
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){
@@ -53,7 +54,7 @@ public final class AddGregtechRecipe {
try {
IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA;
if (IGT_RecipeAdder != null){
- Class classRA = IGT_RecipeAdder.getClass();
+ 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);
@@ -66,4 +67,79 @@ public final class AddGregtechRecipe {
return false;
}
+ public static boolean addCircuitAssemblerRecipe(
+ ItemStack[] aInputs,
+ FluidStack aFluidInput,
+ ItemStack aOutput,
+ int aDuration,
+ int aEUt) {
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+ 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);
+
+ 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;
+ }
+
} \ No newline at end of file