aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorunknown <gtandemmodding@gmail.com>2022-04-11 13:28:28 +1000
committerunknown <gtandemmodding@gmail.com>2022-04-11 13:28:28 +1000
commit6841a0b2c6770e530f52497176f34c08329a52bb (patch)
treef1f679e025c7b656a8187454ecb2b158bde2e073 /src/main/java
parent852c2f91a59a96c85a4ac4606b433e95003f8819 (diff)
downloadGT5-Unofficial-6841a0b2c6770e530f52497176f34c08329a52bb.tar.gz
GT5-Unofficial-6841a0b2c6770e530f52497176f34c08329a52bb.tar.bz2
GT5-Unofficial-6841a0b2c6770e530f52497176f34c08329a52bb.zip
Change colour of various fluids, partially change ZPM+ recipes' rubber
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java3
-rw-r--r--src/main/java/com/elisis/gtnhlanth/common/register/WerkstoffMaterialPool.java22
-rw-r--r--src/main/java/com/elisis/gtnhlanth/loader/ZPMRubberChanges.java286
3 files changed, 300 insertions, 11 deletions
diff --git a/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java b/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java
index d52352f6e6..681260e2aa 100644
--- a/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java
+++ b/src/main/java/com/elisis/gtnhlanth/GTNHLanthanides.java
@@ -9,6 +9,7 @@ import com.elisis.gtnhlanth.common.register.LanthItemList;
import com.elisis.gtnhlanth.common.register.WerkstoffMaterialPool;
import com.elisis.gtnhlanth.loader.BotRecipes;
import com.elisis.gtnhlanth.loader.RecipeLoader;
+import com.elisis.gtnhlanth.loader.ZPMRubberChanges;
import com.elisis.gtnhlanth.xmod.nei.IMC;
import com.github.bartimaeusnek.bartworks.API.WerkstoffAdderRegistry;
import com.github.bartimaeusnek.bartworks.system.material.Werkstoff;
@@ -22,6 +23,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
+import gregtech.api.GregTech_API;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_Log;
@@ -47,6 +49,7 @@ public class GTNHLanthanides {
WerkstoffAdderRegistry.addWerkstoffAdder(new WerkstoffMaterialPool());
WerkstoffAdderRegistry.addWerkstoffAdder(new BotWerkstoffMaterialPool());
LanthItemList.register();
+ GregTech_API.sAfterGTPostload.add(new ZPMRubberChanges());
proxy.preInit(e);
}
diff --git a/src/main/java/com/elisis/gtnhlanth/common/register/WerkstoffMaterialPool.java b/src/main/java/com/elisis/gtnhlanth/common/register/WerkstoffMaterialPool.java
index 7f8d2359b0..db03ec7ed9 100644
--- a/src/main/java/com/elisis/gtnhlanth/common/register/WerkstoffMaterialPool.java
+++ b/src/main/java/com/elisis/gtnhlanth/common/register/WerkstoffMaterialPool.java
@@ -854,7 +854,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff CalciumFluoride = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {255, 250, 250},
"Calcium Fluoride",
subscriptNumbers("CaF2"),
new Werkstoff.Stats().setElektrolysis(true),
@@ -890,7 +890,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff TerbiumNitrate = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {167, 252, 0},
"Terbium Nitrate",
subscriptNumbers("TbNO3"),
new Werkstoff.Stats().setElektrolysis(true),
@@ -919,7 +919,7 @@ public class WerkstoffMaterialPool implements Runnable {
// Weird/Exciting Chemicals
public static final Werkstoff Tetrahydrofuran = new Werkstoff(
- new short[] {255, 255, 255}, //TODO
+ new short[] {222, 165, 164},
"Tetrahydrofuran",
subscriptNumbers("(CH2)4O"),
new Werkstoff.Stats(),
@@ -931,7 +931,7 @@ public class WerkstoffMaterialPool implements Runnable {
//1,4-Butanediol
public static final Werkstoff Butanediol = new Werkstoff(
- new short[] {255, 255, 255}, //TODO
+ new short[] {185, 78, 72},
"1,4-Butanediol",
subscriptNumbers("HO(CH2)4OH"),
new Werkstoff.Stats(),
@@ -987,7 +987,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff Polytetrahydrofuran = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {192, 128, 129},
"Polytetrahydrofuran",
subscriptNumbers("(C4H8O)OH2"),
new Werkstoff.Stats(),
@@ -998,7 +998,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff TungstophosphoricAcid = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {223, 255, 0},
"Tungstophosphoric Acid",
subscriptNumbers("H3PW12O40"),
new Werkstoff.Stats(),
@@ -1020,7 +1020,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff Dinitrotoluene = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {216, 191, 216},
"Dinitrotoluene",
subscriptNumbers("C7H6N2O4"),
new Werkstoff.Stats(),
@@ -1031,7 +1031,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff Diaminotoluene = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {227, 218, 201},
"Diaminotoluene",
subscriptNumbers("C6H3(NH2)2CH3"),
new Werkstoff.Stats(),
@@ -1053,7 +1053,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff PTMEGElastomer = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {248, 248, 255},
"PTMEG Elastomer",
new Werkstoff.Stats().setMeltingPoint(600).setMeltingVoltage(64),
Werkstoff.Types.COMPOUND,
@@ -1068,7 +1068,7 @@ public class WerkstoffMaterialPool implements Runnable {
public static final Werkstoff MagnesiumPeroxide = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {255, 250, 205},
"Magnesium Peroxide",
new Werkstoff.Stats(),
Werkstoff.Types.COMPOUND,
@@ -1078,7 +1078,7 @@ public class WerkstoffMaterialPool implements Runnable {
);
public static final Werkstoff PotassiumChlorate = new Werkstoff(
- new short[] {255, 255, 255},
+ new short[] {240, 255, 255},
"Potassium Chlorate",
new Werkstoff.Stats(),
Werkstoff.Types.COMPOUND,
diff --git a/src/main/java/com/elisis/gtnhlanth/loader/ZPMRubberChanges.java b/src/main/java/com/elisis/gtnhlanth/loader/ZPMRubberChanges.java
new file mode 100644
index 0000000000..7ebb17c935
--- /dev/null
+++ b/src/main/java/com/elisis/gtnhlanth/loader/ZPMRubberChanges.java
@@ -0,0 +1,286 @@
+package com.elisis.gtnhlanth.loader;
+
+import static gregtech.api.enums.OrePrefixes.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.apache.commons.lang3.reflect.MethodUtils;
+
+import com.elisis.gtnhlanth.common.register.WerkstoffMaterialPool;
+import com.github.bartimaeusnek.bartworks.API.LoaderReference;
+import com.github.bartimaeusnek.bartworks.system.material.Werkstoff;
+import com.github.bartimaeusnek.bartworks.util.BW_Util;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.objects.ItemData;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Shaped_Recipe;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
+import net.minecraft.item.crafting.IRecipe;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class ZPMRubberChanges implements Runnable {
+
+ @SuppressWarnings("unchecked")
+ public void run() {
+
+ List<IRecipe> bufferedRecipeList = null;
+
+ try {
+ bufferedRecipeList = (List<IRecipe>) FieldUtils.getDeclaredField(GT_ModHandler.class, "sBufferRecipeList", true).get(null);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ HashSet<ItemStack> ZPMPlusComponents = new HashSet<>();
+ OrePrefixes[] RubberGenerated = {plate};
+
+ Arrays.stream(ItemList.values())
+ .filter(item ->
+ (item.toString().contains("ZPM")
+ || item.toString().contains("UV")
+ || item.toString().contains("UHV")
+ || item.toString().contains("UEV"))
+ && item.hasBeenSet())
+ .forEach(item -> ZPMPlusComponents.add(item.get(1)));
+
+
+ if (LoaderReference.dreamcraft) {
+ addDreamcraftItemListItems(ZPMPlusComponents);
+ }
+
+ for (ItemStack component : ZPMPlusComponents) {
+ GT_Log.out.print(component.getDisplayName() + " ");
+ }
+
+ replaceAllRecipes(ZPMPlusComponents, RubberGenerated, bufferedRecipeList);
+
+
+ }
+
+
+ private static void replaceAllRecipes(Collection<ItemStack> ZPMPlusComponents, OrePrefixes[] RubberGenerated, List<IRecipe> bufferedRecipeList){
+
+ for (GT_Recipe_AssemblyLine sAssemblylineRecipe : GT_Recipe_AssemblyLine.sAssemblylineRecipes) {
+ for (ItemStack stack : ZPMPlusComponents) {
+ rewriteAsslineRecipes(stack, RubberGenerated, sAssemblylineRecipe);
+ }
+ }
+
+ for (GT_Recipe_Map map : GT_Recipe_Map.sMappings) {
+ for (GT_Recipe recipe : map.mRecipeList) {
+ for (ItemStack stack : ZPMPlusComponents) {
+ rewriteMachineRecipes(stack, RubberGenerated, recipe);
+ }
+ }
+ }
+
+ for (ItemStack stack : ZPMPlusComponents) {
+ Predicate recipeFilter = obj -> obj instanceof GT_Shaped_Recipe && GT_Utility.areStacksEqual(((GT_Shaped_Recipe) obj).getRecipeOutput(), stack, true);
+ rewriteCraftingRecipes(bufferedRecipeList, RubberGenerated, recipeFilter);
+ }
+/*
+ for (ItemStack stack : LuVMachines) {
+ Predicate recipeFilter = obj -> obj instanceof GT_Shaped_Recipe && GT_Utility.areStacksEqual(((GT_Shaped_Recipe) obj).getRecipeOutput(), stack, true);
+ rewriteCraftingRecipes(bufferedRecipeList, LuVMaterialsGenerated, recipeFilter);
+ }*/
+ }
+
+ private static void addDreamcraftItemListItems(Collection ZPMPlusComponents){
+ try {
+ Class customItemListClass = Class.forName("com.dreammaster.gthandler.CustomItemList");
+ Method hasnotBeenSet = MethodUtils.getAccessibleMethod(customItemListClass, "hasBeenSet");
+ Method get = MethodUtils.getAccessibleMethod(customItemListClass, "get", long.class, Object[].class);
+ for (Enum customItemList : (Enum[]) FieldUtils.getField(customItemListClass, "$VALUES", true).get(null)) {
+ if ((customItemList.toString().contains("ZPM")
+ || customItemList.toString().contains("UV")
+ || customItemList.toString().contains("UHV")
+ || customItemList.toString().contains("UEV")
+ ) && (boolean) hasnotBeenSet.invoke(customItemList))
+ ZPMPlusComponents.add((ItemStack) get.invoke(customItemList, 1, new Object[0]));
+ }
+ } catch (IllegalAccessException | ClassNotFoundException | InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void rewriteCraftingRecipes(List<IRecipe> bufferedRecipeList, OrePrefixes[] RubberGenerated, Predicate recipeFilter){
+ for (OrePrefixes prefixes : RubberGenerated) {
+
+ Consumer recipeAction = (obj) -> {
+ ZPMRubberChanges.doStacksCointainAndReplace(((GT_Shaped_Recipe) obj).getInput(),
+ GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true,
+ WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(((GT_Shaped_Recipe) obj).getInput(),
+ GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true,
+ WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ };
+
+
+
+
+ /*
+ || ZPMRubberChanges.doStacksCointainAndReplace(((GT_Shaped_Recipe) obj).getInput(),
+ GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true,
+ WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));*/
+
+
+ CraftingManager.getInstance().getRecipeList().stream().filter(recipeFilter).forEach(recipeAction);
+ bufferedRecipeList.stream().filter(recipeFilter).forEach(recipeAction);
+ }
+ }
+
+ private static void rewriteMachineRecipes(ItemStack stack, OrePrefixes[] RubberGenerated, GT_Recipe recipe) {
+ if (ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, stack, false)) {
+ for (OrePrefixes prefixes : RubberGenerated) {
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mOutputs, GT_OreDictUnificator.get(prefixes, Materials.Silicon, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mOutputs, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ }
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidInputs, Materials.Silicone.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidOutputs, Materials.Silicone.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidInputs, Materials.StyreneButadieneRubber.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidOutputs, Materials.StyreneButadieneRubber.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ }
+ if (ZPMRubberChanges.doStacksCointainAndReplace(recipe.mOutputs, stack, false)) {
+ for (OrePrefixes prefixes : RubberGenerated) {
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mOutputs, GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mOutputs, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ }
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidInputs, Materials.Silicone.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidOutputs, Materials.Silicone.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidInputs, Materials.StyreneButadieneRubber.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidOutputs, Materials.StyreneButadieneRubber.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ }
+ }
+
+ private static void rewriteAsslineRecipes(ItemStack stack, OrePrefixes[] RubberGenerated, GT_Recipe.GT_Recipe_AssemblyLine recipe){
+ GT_Log.out.print("In rewriteAsslineRecipes!\n");
+ for (OrePrefixes prefixes : RubberGenerated) {
+ GT_Log.out.print("In rewriteAsslineRecipes Pt. 2!\n");
+ //GT_Log.out.print(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Silicone, 1).getDisplayName() + " WOWWOO");
+ if (ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, stack, false)) {
+
+ GT_Log.out.print(Arrays.toString(recipe.mInputs));
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(new Object[]{recipe.mOutput}, GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(new Object[]{recipe.mOutput}, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ }
+ if (ZPMRubberChanges.doStacksCointainAndReplace(new Object[]{recipe.mOutput}, stack, false)) {
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(new Object[]{recipe.mOutput}, GT_OreDictUnificator.get(prefixes, Materials.Silicone, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ ZPMRubberChanges.doStacksCointainAndReplace(new Object[]{recipe.mOutput}, GT_OreDictUnificator.get(prefixes, Materials.StyreneButadieneRubber, 1), true, WerkstoffMaterialPool.PTMEGElastomer.get(prefixes));
+ }
+ }
+ if (ZPMRubberChanges.doStacksCointainAndReplace(recipe.mInputs, stack, false)) {
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidInputs, Materials.Silicone.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidInputs, Materials.StyreneButadieneRubber.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ }
+ if (ZPMRubberChanges.doStacksCointainAndReplace(new Object[]{recipe.mOutput}, stack, false)) {
+ ZPMRubberChanges.doStacksCointainAndReplace(recipe.mFluidInputs, Materials.StyreneButadieneRubber.getMolten(1), true, WerkstoffMaterialPool.PTMEGElastomer.getMolten(1).getFluid());
+ }
+ }
+
+ private static ItemStack[] replaceArrayWith(ItemStack[] stackArray, Materials source, Werkstoff target) {
+ for (int i = 0; i < stackArray.length; i++) {
+ ItemStack stack = stackArray[i];
+ if (!BW_Util.checkStackAndPrefix(stack))
+ continue;
+ stackArray[i] = replaceStackWith(stack, source, target);
+ }
+ return stackArray;
+ }
+
+ private static ItemStack replaceStackWith(ItemStack stack, Materials source, Werkstoff target) {
+ ItemData ass = GT_OreDictUnificator.getAssociation(stack);
+ if (ass.mMaterial.mMaterial.equals(source))
+ if (target.hasItemType(ass.mPrefix))
+ stack = target.get(ass.mPrefix, stack.stackSize);
+ return stack;
+ }
+
+
+ private static boolean doStacksCointainAndReplace(FluidStack[] stacks, FluidStack stack, boolean replace, Fluid... replacement) {
+ boolean replaced = false;
+ for (int i = 0; i < stacks.length; i++) {
+ if (GT_Utility.areFluidsEqual(stack, stacks[i]))
+ if (!replace)
+ return true;
+ else {
+ int amount = stacks[i].amount;
+ stacks[i] = new FluidStack(replacement[0], amount);
+ replaced = true;
+ }
+ }
+ return replaced;
+ }
+
+
+ private static boolean doStacksCointainAndReplace(Object[] stacks, ItemStack stack, boolean replace, ItemStack... replacement) {
+ //GT_Log.out.print("In doStacksCointainAndReplace!\n");
+ boolean replaced = false;
+ for (int i = 0; i < stacks.length; i++) {
+ if (!GT_Utility.isStackValid(stacks[i])) {
+ if (stacks[i] instanceof ArrayList && ((ArrayList)stacks[i]).size() > 0) {
+ if (GT_Utility.areStacksEqual(stack, (ItemStack) ((ArrayList)stacks[i]).get(0), true))
+ if (!replace)
+ return true;
+ else {
+ int amount = ((ItemStack) ((ArrayList)stacks[i]).get(0)).stackSize;
+ stacks[i] = new ArrayList<>();
+ ((ArrayList)stacks[i]).add(BW_Util.setStackSize(replacement[0], amount));
+ replaced = true;
+
+ GT_Log.out.print("Replaced recipe!: " + stack.getDisplayName() + " ");
+ }
+
+ } else
+ continue;
+ } else if (GT_Utility.areStacksEqual(stack, (ItemStack) stacks[i], true))
+ if (!replace)
+ return true;
+ else {
+ int amount = ((ItemStack) stacks[i]).stackSize;
+ stacks[i] = BW_Util.setStackSize(replacement[0], amount);
+ replaced = true;
+ }
+ }
+ return replaced;
+ }
+
+
+
+
+}