aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2021-11-29 00:04:28 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2021-11-29 00:04:28 +0000
commit428d5e191ff87cc1e71428d802779334f89029db (patch)
treea035d0391329ea8aa806f1e114d5500a95a2e039
parent258679b1d299e653695cd9c94e5e36db0791d0a2 (diff)
downloadGT5-Unofficial-428d5e191ff87cc1e71428d802779334f89029db.tar.gz
GT5-Unofficial-428d5e191ff87cc1e71428d802779334f89029db.tar.bz2
GT5-Unofficial-428d5e191ff87cc1e71428d802779334f89029db.zip
Greatly improved ICO recipe importation from Pyro Oven.
-rw-r--r--src/Java/gregtech/api/util/GTPP_Recipe.java2
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java61
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java7
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java24
4 files changed, 59 insertions, 35 deletions
diff --git a/src/Java/gregtech/api/util/GTPP_Recipe.java b/src/Java/gregtech/api/util/GTPP_Recipe.java
index 24459aca92..5bd8580995 100644
--- a/src/Java/gregtech/api/util/GTPP_Recipe.java
+++ b/src/Java/gregtech/api/util/GTPP_Recipe.java
@@ -328,7 +328,7 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe {
*/
public static final Collection<GTPP_Recipe_Map> sMappings = new ArrayList<>();
//public static final GT_Recipe_Map sChemicalBathRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(200), "gtpp.recipe.chemicalbath", "Chemical Bath", null, RES_PATH_GUI + "basicmachines/ChemicalBath", 1, 3, 1, 1, 1, E, 1, E, true, true);
- public static final GTPP_Recipe_Map_Internal sCokeOvenRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 2, 1, 0, 1, E, 1, E, true, true);
+ public static final GTPP_Recipe_Map_Internal sCokeOvenRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.cokeoven", "Coke Oven", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 1, 0, 1, E, 1, E, true, true);
public static final GTPP_Recipe_Map_Internal sMatterFab2Recipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.matterfab2", "Matter Fabricator", null, RES_PATH_GUI + "basicmachines/Default", 9, 9, 0, 0, 1, E, 1, E, true, true);
//public static final Gregtech_Recipe_Map sMatterFabRecipes = new Gregtech_Recipe_Map(new HashSet<GregtechRecipe>(200), "gtpp.recipe.matterfab", "Matter Fabricator", null, RES_PATH_GUI + "basicmachines/Massfabricator", 1, 3, 1, 1, 1, E, 1, E, true, true);
diff --git a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java
index 0b22ea3acc..fc8e84cb61 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java
@@ -3,16 +3,15 @@ package gtPlusPlus.core.util.reflect;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import net.minecraft.item.ItemStack;
-
import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.internal.IGT_RecipeAdder;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public final class AddGregtechRecipe {
@@ -24,53 +23,47 @@ public final class AddGregtechRecipe {
if (aRecipe.mInputs == null || aRecipe.mFluidInputs == null || aRecipe.mFluidOutputs == null || aRecipe.mOutputs == null) {
return false;
- }
-
- if (aRecipe.mInputs.length > 2 || aRecipe.mFluidInputs.length > 1 || aRecipe.mFluidOutputs.length > 1 || aRecipe.mOutputs.length > 1) {
+ }
+ if (aRecipe.mInputs.length > 2 || aRecipe.mFluidInputs.length > 1 || aRecipe.mFluidOutputs.length > 1 || aRecipe.mOutputs.length > 9) {
return false;
}
- else if (aRecipe.mInputs.length <= 0 || aRecipe.mFluidInputs.length <= 0 || aRecipe.mFluidOutputs.length <= 0 || aRecipe.mOutputs.length <= 0) {
+ else if (aRecipe.mInputs.length <= 0) {
return false;
}
int aCircuitNumber = -1;
- int aItemSlot = -1;
+ Item aCircuit = CI.getNumberedCircuit(1).getItem();
+ boolean hasCircuit = false;
- int aSlot = 0;
for (ItemStack a : aRecipe.mInputs) {
- if (a != null && a.getItem() != CI.getNumberedCircuit(1).getItem()) {
- aItemSlot = aSlot;
- }
- else {
- aSlot++;
+ if (a != null && a.getItem() == aCircuit) {
+ hasCircuit = true;
+ aCircuitNumber = a.getItemDamage();
+ break;
}
}
- for (int i=0;i<25;i++) {
- ItemStack aTest = CI.getNumberedCircuit(i);
- for (ItemStack a : aRecipe.mInputs) {
- if (a != null && GT_Utility.areStacksEqual(a, aTest)) {
- aCircuitNumber = i;
- break;
- }
- }
+ ItemStack aInputItem = null;
+ if (!hasCircuit || aCircuitNumber < 1) {
+ return false;
}
- if (aCircuitNumber < 0) {
- return false;
+ for (ItemStack a : aRecipe.mInputs) {
+ if (a != null && a.getItem() != aCircuit) {
+ aInputItem = a;
+ break;
+ }
}
-
return CORE.RA.addCokeOvenRecipe(
- aRecipe.mInputs[aItemSlot],
- ItemUtils.getGregtechCircuit(aCircuitNumber),
- aRecipe.mFluidInputs[0],
- aRecipe.mFluidOutputs[0],
- aRecipe.mOutputs[0],
- aModifiedTime,
- aRecipe.mEUt);
-
-
+ aCircuitNumber,
+ aInputItem,
+ aRecipe.mFluidInputs,
+ aRecipe.mFluidOutputs,
+ aRecipe.mOutputs,
+ aModifiedTime,
+ aRecipe.mEUt);
+
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
index b4091cb42f..945ff7bf0e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
@@ -22,6 +22,13 @@ public interface IGregtech_RecipeAdder {
//public boolean addCokeOvenRecipe(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue);
public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput, int aDuration, int aEUt);
+
+ public boolean addCokeOvenRecipe(int aCircuit, ItemStack aInput2, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt);
+
+
+ public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt);
+
+
public boolean addFuel(ItemStack aInput1, ItemStack aOutput1, int aEU, int aType);
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
index 58f9f1d12c..afb0303470 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
@@ -157,6 +157,30 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder {
return false;
}
}
+
+
+ @Override
+ public boolean addCokeOvenRecipe(int aCircuit, ItemStack aInput2, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt) {
+ return addCokeOvenRecipe(CI.getNumberedCircuit(aCircuit), aInput2, aFluidInputs, aFluidOutputs, aOutputs, aDuration, aEUt);
+ }
+
+ @Override
+ public boolean addCokeOvenRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, ItemStack[] aOutputs, int aDuration, int aEUt) {
+ GTPP_Recipe aSpecialRecipe = new GTPP_Recipe(
+ true,
+ new ItemStack[] { aInput1, aInput2 },
+ aOutputs,
+ null,
+ new int[] {},
+ aFluidInputs,
+ aFluidOutputs,
+ Math.max(1, aDuration),
+ Math.max(1, aEUt),
+ 0);
+ int aSize = GTPP_Recipe.GTPP_Recipe_Map.sCokeOvenRecipes.mRecipeList.size();
+ GTPP_Recipe.GTPP_Recipe_Map.sCokeOvenRecipes.add(aSpecialRecipe);
+ return GTPP_Recipe.GTPP_Recipe_Map.sCokeOvenRecipes.mRecipeList.size() > aSize;
+ }
@Override
public boolean addMatterFabricatorRecipe(final FluidStack aFluidInput, final FluidStack aFluidOutput,