diff options
Diffstat (limited to 'src')
5 files changed, 242 insertions, 93 deletions
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index b263f8ff52..5156b938db 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -482,7 +482,7 @@ public class RECIPES_GREGTECH { CORE.RA.addAssemblylineRecipe( ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_1_CONTAINMENT, 1), 20 * 60 * 30, - new ItemStack[] { + new Object[] { ItemList.Field_Generator_IV.get(GTNH ? 32 : 16), ItemList.Electric_Motor_EV.get(GTNH ? 64 : 32), ItemList.Energy_LapotronicOrb.get(GTNH ? 32 : 16), @@ -492,9 +492,9 @@ public class RECIPES_GREGTECH { ELEMENT.getInstance().GADOLINIUM.getDust(GTNH ? 32 : 8), ELEMENT.getInstance().SAMARIUM.getDust(GTNH ? 16 : 4), ALLOY.ARCANITE.getGear(GTNH ? 8 : 2), - CI.getTieredComponent(OrePrefixes.circuit, 5, GTNH ? 64 : 32), - CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 8), + new Object[] {CI.getTieredCircuitOreDictName(5), 64}, + new Object[] {CI.getTieredCircuitOreDictName(6), 32}, + new Object[] {CI.getTieredCircuitOreDictName(7), 16}, GregtechItemList.Laser_Lens_Special.get(1), aCoilWire[3] }, @@ -503,7 +503,6 @@ public class RECIPES_GREGTECH { ALLOY.ENERGYCRYSTAL.getFluidStack(144 * 9 * (GTNH ? 8 : 4)), ALLOY.TUMBAGA.getFluidStack(144 * 9 * (GTNH ? 32 : 8)), ALLOY.NICHROME.getFluidStack(144 * 1 * (GTNH ? 16 : 4)), - }, ItemUtils.getSimpleStack(ModBlocks.blockCasings3Misc, 15, 32), 20 * 60 * 10 * (GTNH ? 2 : 1), @@ -564,7 +563,7 @@ public class RECIPES_GREGTECH { CORE.RA.addAssemblylineRecipe( ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), 20 * 60 * 60 * 24, - new ItemStack[] { + new Object[] { CI.getTieredMachineHull(8, 4), CI.getConveyor(8, GTNH ? 24 : 12), CI.getElectricMotor(7, GTNH ? 32 : 16), @@ -574,7 +573,7 @@ public class RECIPES_GREGTECH { CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 48 : 24), CI.getTieredComponent(OrePrefixes.bolt, 7, GTNH ? 32 : 16), CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 12 : 6), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 20 : 10), + new Object[] {CI.getTieredCircuitOreDictName(7), 20}, CI.getTieredComponent(OrePrefixes.rotor, 6, GTNH ? 16 : 8), }, new FluidStack[] { @@ -651,11 +650,11 @@ public class RECIPES_GREGTECH { CORE.RA.addAssemblylineRecipe( aExoticInputs[aCasingSlot], 20 * 60 * 60 * 5, - new ItemStack[] { + new Object[] { aGemCasings[aCasingSlot], ItemUtils.getSimpleStack(aExoticInputs[aCasingSlot], 16), CI.getTieredComponent(OrePrefixes.plate, j, 16), - CI.getTieredComponent(OrePrefixes.circuit, j, 8), + new Object[] {CI.getTieredCircuitOreDictName(j), 8}, CI.getTieredComponent(OrePrefixes.wireGt16, j+1, GTNH ? 32 : 16), CI.getTieredComponent(OrePrefixes.bolt, j, GTNH ? 8 : 4), CI.getTieredComponent(OrePrefixes.screw, j-1, GTNH ? 8 : 4), @@ -677,10 +676,10 @@ public class RECIPES_GREGTECH { CORE.RA.addAssemblylineRecipe( ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), 20 * 60 * 10, - new ItemStack[] { + new Object[] { ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + new Object[] {CI.getTieredCircuitOreDictName(7), 16}, CI.getTieredComponent(OrePrefixes.cableGt02, 7, GTNH ? 16 : 8), CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 6 : 3), CI.getTieredComponent(OrePrefixes.screw, 7, GTNH ? 16 : 8), @@ -722,12 +721,12 @@ public class RECIPES_GREGTECH { CORE.RA.addAssemblylineRecipe( aChargeResearch[aCurrSlot], 20 * 60 * 10 * (aCurrSlot + 1), - new ItemStack[] { + new Object[] { ItemUtils.getSimpleStack(aGemBatteries[aCurrSlot],2), aCoilWire[aCurrSlot], CI.getTieredComponent(OrePrefixes.plate, h, 8), - CI.getTieredComponent(OrePrefixes.circuit, h, 4), - CI.getTieredComponent(OrePrefixes.circuit, h-1, 8), + new Object[] {CI.getTieredCircuitOreDictName(h), 4}, + new Object[] {CI.getTieredCircuitOreDictName(h-1), 8}, CI.getTieredComponent(OrePrefixes.cableGt12, h-1, 16), CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), @@ -749,10 +748,10 @@ public class RECIPES_GREGTECH { CORE.RA.addAssemblylineRecipe( ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), 20 * 60 * 10, - new ItemStack[] { + new Object[] { ItemUtils.getSimpleStack(aGemCasings[3], GTNH ? 4 : 2), CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + new Object[] {CI.getTieredCircuitOreDictName(7), 16}, CI.getTieredComponent(OrePrefixes.cableGt04, 8, GTNH ? 16 : 8), CI.getTieredComponent(OrePrefixes.gearGt, 7, GTNH ? 6 : 3), CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 16 : 8), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index af244818b9..44657d158b 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -1847,9 +1847,9 @@ public class RECIPES_Machines { CORE.RA.addAssemblylineRecipe( ItemList.FusionComputer_UV.get(1), (int) GT_Values.V[5], - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(9), 4 * (GTNH ? 2 : 1)), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(7), 32 * (GTNH ? 2 : 1)), + new Object[] { + new Object[] {CI.getTieredCircuitOreDictName(9), 4 * (GTNH ? 2 : 1)}, + new Object[] {CI.getTieredCircuitOreDictName(7), 32 * (GTNH ? 2 : 1)}, ItemUtils.getItemStackOfAmountFromOreDict("wireGt16Superconductor", 8 * (GTNH ? 4 : 2)), ItemUtils.getItemStackOfAmountFromOreDict("plateDenseNeutronium", 2 * (GTNH ? 4 : 1)), ItemUtils.getSimpleStack((GTNH ? CI.fieldGenerator_MAX : CI.fieldGenerator_ZPM), 5), @@ -1869,9 +1869,9 @@ public class RECIPES_Machines { CORE.RA.addAssemblylineRecipe( ItemList.Casing_Fusion2.get(1), (int) GT_Values.V[4], - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(5), 8 * (GTNH ? 2 : 1)), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(4), 16 * (GTNH ? 2 : 1)), + new Object[] { + new Object[] {CI.getTieredCircuitOreDictName(5), 8 * (GTNH ? 2 : 1)}, + new Object[] {CI.getTieredCircuitOreDictName(4), 16 * (GTNH ? 2 : 1)}, ItemUtils.getItemStackOfAmountFromOreDict("blockTungstenCarbide", 4 * (GTNH ? 2 : 1)), ItemUtils.getItemStackOfAmountFromOreDict("plateNeutronium", 2 * (GTNH ? 2 : 1)), ItemUtils.getSimpleStack((GTNH ? CI.electricMotor_MAX : CI.electricMotor_ZPM), 3 * (GTNH ? 2 : 1)), @@ -1891,14 +1891,14 @@ public class RECIPES_Machines { CORE.RA.addAssemblylineRecipe( ItemList.Casing_Fusion_Coil.get(1), (int) GT_Values.V[4], - new ItemStack[] { - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(8), 4 * (GTNH ? 2 : 1)), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), 8 * (GTNH ? 2 : 1)), + new Object[] { + new Object[] {CI.getTieredCircuitOreDictName(8), 4 * (GTNH ? 2 : 1)}, + new Object[] {CI.getTieredCircuitOreDictName(6), 8 * (GTNH ? 2 : 1)}, ItemUtils.getItemStackOfAmountFromOreDict("plateNeutronium", 2 * (GTNH ? 3 : 1)), ItemUtils.getSimpleStack((GTNH ? CI.emitter_MAX : CI.emitter_ZPM), 2 * (GTNH ? 2 : 1)), ItemUtils.getSimpleStack((GTNH ? CI.sensor_MAX : CI.sensor_ZPM), 2 * (GTNH ? 2 : 1)), ItemUtils.getSimpleStack((GTNH ? CI.fieldGenerator_MAX : CI.fieldGenerator_LuV), 2 * (GTNH ? 2 : 1)), - ItemUtils.getSimpleStack((GTNH ? ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(8), 8) : CI.getDataOrb()), 8 * (GTNH ? 2 : 1)), + new Object[] {CI.getTieredCircuitOreDictName(8), 8}, ItemList.Energy_LapotronicOrb2.get(2 * (GTNH ? 16 : 1)), ItemList.Casing_Fusion_Coil.get(1) }, @@ -2423,11 +2423,11 @@ public class RECIPES_Machines { CORE.RA.addAssemblylineRecipe( ItemList.Machine_IV_Macerator.get(1), 20 * 60 * 20, - new ItemStack[] { + new Object[] { GregtechItemList.Casing_IsaMill_Gearbox.get(4), CI.getTieredGTPPMachineCasing(6, 4), ItemList.Component_Grinder_Tungsten.get(16), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), 8), + new Object[] {CI.getTieredCircuitOreDictName(6), 8}, ALLOY.INCONEL_625.getGear(8), ALLOY.INCONEL_625.getPlate(32), ALLOY.ZERON_100.getPlateDouble(8), @@ -2497,11 +2497,11 @@ public class RECIPES_Machines { CORE.RA.addAssemblylineRecipe( ItemList.Distillation_Tower.get(1), 20 * 60 * 20, - new ItemStack[] { + new Object[] { GregtechItemList.Casing_Flotation_Cell.get(4), CI.getTieredGTPPMachineCasing(5, 4), ItemList.Machine_IV_Distillery.get(1), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), 8), + new Object[] {CI.getTieredCircuitOreDictName(6), 8}, ALLOY.STELLITE.getGear(8), ALLOY.STELLITE.getPlate(32), ALLOY.HASTELLOY_N.getPlateDouble(8), @@ -2563,6 +2563,7 @@ public class RECIPES_Machines { ELEMENT.getInstance().HELIUM.getCell(8), ELEMENT.getInstance().FLUORINE.getCell(8), ALLOY.HS188A.getIngot(8), + ItemList.Distillation_Tower.get(1) }, null, ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_10_SPARGING, 1), @@ -2573,11 +2574,11 @@ public class RECIPES_Machines { CORE.RA.addAssemblylineRecipe( ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_10_SPARGING, 1), 20 * 60 * 20, - new ItemStack[] { + new Object[] { GregtechItemList.Casing_Sparge_Tower_Exterior.get(4), CI.getTieredGTPPMachineCasing(4, 4), ItemList.Machine_IV_Distillery.get(1), - ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(5), 8), + new Object[] {CI.getTieredCircuitOreDictName(5), 8}, ALLOY.HS188A.getGear(8), ALLOY.HS188A.getPlate(32), ALLOY.HASTELLOY_N.getPlateDouble(8), 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 217731dea7..6bf048320f 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 @@ -217,9 +217,27 @@ public interface IGregtech_RecipeAdder { public boolean addAssemblerRecipeWithOreDict(Object aInput1, int aAmount1, Object aInput2, int aAmount2, FluidStack aInputFluid, ItemStack aOutput, int a1, int a2); public boolean addSixSlotAssemblingRecipe(ItemStack[] aInputs, FluidStack aInputFluid, ItemStack aOutput1, int aDuration, int aEUt); - + /** + * Adds an Assemblyline Recipe + * + * @param aInputs must be != null, 4-16 inputs + * @param aFluidInputs 0-4 fluids + * @param aOutput1 must be != null + * @param aDuration must be > 0 + * @param aEUt should be > 0 + */ public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt); + /** + * Adds a Assemblyline Recipe + * + * @param aInputs elements should be: ItemStack for single item; + * ItemStack[] for multiple equivalent items; + * {OreDict, amount} for oredict. + */ + boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); + + public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, int time, int eu); public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, Object object, int time, int eu); public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, ItemStack object, int time); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java new file mode 100644 index 0000000000..830fae78ab --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_MetalRecipe.java @@ -0,0 +1,119 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.interfaces.RunnableWithInfo; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.util.minecraft.ItemUtils; + +import java.util.HashSet; +import java.util.Set; + +public class RecipeGen_MetalRecipe extends RecipeGen_Base { + + public final static Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<RunnableWithInfo<Material>>(); + static { + MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); + } + + public RecipeGen_MetalRecipe(final Material M){ + this.toGenerate = M; + mRecipeGenMap.add(this); + } + + @Override + public void run() { + generateRecipes(this.toGenerate); + } + + private void generateRecipes(final Material material) { + + Logger.WARNING("Generating Metal recipes for "+material.getLocalizedName()); + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getBlock(1))) + if (GT_ModHandler.addCompressionRecipe( + material.getIngot(9), + material.getBlock(1) + )){ + Logger.WARNING("Compress Block Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Compress Block Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) + if (GT_Values.RA.addLatheRecipe( + material.getIngot(1), + material.getRod(1), + material.getSmallDust(2), + (int) Math.max(material.getMass() / 8L, 1L), + material.vVoltageMultiplier)){ + Logger.WARNING("Lathe Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Lathe Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getBolt(1))) + if (GT_Values.RA.addCutterRecipe( + material.getRod(1), + material.getBolt(4), + null, + (int) Math.max(material.getMass() * 2L, 1L), + material.vVoltageMultiplier)){ + Logger.WARNING("Cut Bolt Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Cut Bolt Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getHotIngot(1))) + if (CORE.RA.addVacuumFreezerRecipe( + material.getHotIngot(1), + material.getIngot(1), + (int) Math.max(material.getMass() * 3L, 1L), + material.vVoltageMultiplier) + ){ + Logger.WARNING("Cool Hot Ingot Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Cool Hot Ingot Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getLongRod(1))) { + if (GT_Values.RA.addForgeHammerRecipe( + material.getRod(2), + material.getLongRod(1), + (int) Math.max(material.getMass(), 1L), + 16)){ + Logger.WARNING("Hammer Long Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Hammer Long Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + GT_Values.RA.addCutterRecipe( + material.getLongRod(1), + material.getRod(2), + null, + (int) Math.max(material.getMass(), 1L), + 4); + } + + if (ItemUtils.checkForInvalidItems(material.getBolt(1)) && ItemUtils.checkForInvalidItems(material.getScrew(1))) + if (GT_Values.RA.addLatheRecipe( + material.getBolt(1), + material.getScrew(1), + null, + (int) Math.max(material.getMass() / 8L, 1L), + 4)){ + Logger.WARNING("Lathe Screw Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Lathe Screw Recipe: "+material.getLocalizedName()+" - Failed"); + } + + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 71f618e7a9..be4d6a8f7d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -1,18 +1,23 @@ package gtPlusPlus.xmod.gregtech.recipes; +import static gregtech.GT_Mod.GT_FML_LOGGER; import static gtPlusPlus.core.lib.CORE.GTNH; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.interfaces.internal.IGT_RecipeAdder; import gregtech.api.util.*; import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; +import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -1031,67 +1036,74 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return CORE.RA.addComponentMakerRecipe(aInputs, aInputFluid, aOutput1, aDuration, aEUt); } - public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs_OLD, ItemStack aOutput, int aDuration, int aEUt) { - - FluidStack[] aFluidInputs = new FluidStack[4]; - AutoMap<FluidStack> aNewFluidMap = new AutoMap<FluidStack>(); - if (aFluidInputs_OLD.length > 4) { - for (FluidStack s : aFluidInputs_OLD) { - aNewFluidMap.put(s); - } - for (int i = 0; i < 4; i++) { - aFluidInputs[i] = aNewFluidMap.get(i); - } - } - else { - aFluidInputs = aFluidInputs_OLD; - } - + @Override + public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { + if ((aResearchItem==null)||(aResearchTime<=0)||(aInputs == null) || (aOutput == null) || aInputs.length>15 || aInputs.length<4) { + return false; + } + if ((aDuration = GregTech_API.sRecipeFile.get("assemblingline", aOutput, aDuration)) <= 0) { + return false; + } + for(ItemStack tItem : aInputs){ + if(tItem==null){ + GT_FML_LOGGER.info("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); + } + } + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result", new Object[0])}, null, null, aResearchTime, 30, -201); + GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result", new Object[0])}, aFluidInputs, null, aDuration, aEUt, 0,true); + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe_AssemblyLine( aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt)); + return true; + } - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - if (aInputs.length < 6 && aFluidInputs.length < 2) { - ItemStack[] aInputStack = new ItemStack[] {aResearchItem, aInputs[0], aInputs[1], aInputs[2], aInputs[3], aInputs[4]}; - return addSixSlotAssemblingRecipe(aInputStack, aFluidInputs[0], aOutput, aDuration, aEUt); - } - return false; - } - else { - if ((aResearchItem==null)||(aResearchTime<=0)||(aInputs == null) || (aOutput == null) || aInputs.length>15 || aInputs.length<4) { - return false; - } - else { - if (mAssemblyLine != null) { - try { - if (!tryAddTecTechScannerRecipe(aResearchItem, aInputs, aFluidInputs, aOutput, aDuration, aEUt)) { - try { - Logger.INFO("Failed to generate TecTech recipe for "+ItemUtils.getItemName(aResearchItem)+", please report this to Alkalus."); - } - catch (Throwable t) { - t.printStackTrace(); - } - } - return (boolean) mAssemblyLine.invoke(GT_Values.RA, aResearchItem, aResearchTime, aInputs, - aFluidInputs, aOutput, aDuration, aEUt); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - if (aInputs.length < 6 && aFluidInputs.length < 2) { - ItemStack[] aInputStack = new ItemStack[] { aResearchItem, aInputs[0], aInputs[1], - aInputs[2], aInputs[3], aInputs[4] }; - return addSixSlotAssemblingRecipe(aInputStack, aFluidInputs[0], aOutput, aDuration, - aEUt); - } - return false; - } - } else { - if (aInputs.length < 6 && aFluidInputs.length < 2) { - ItemStack[] aInputStack = new ItemStack[] { aResearchItem, aInputs[0], aInputs[1], aInputs[2], - aInputs[3], aInputs[4] }; - return addSixSlotAssemblingRecipe(aInputStack, aFluidInputs[0], aOutput, aDuration, - aEUt); - } - return false; - } - } - } + @Override + public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { + if ((aResearchItem==null)||(aResearchTime<=0)||(aInputs == null) || (aOutput == null) || aInputs.length>15 || aInputs.length<4) { + return false; + } + if ((aDuration = GregTech_API.sRecipeFile.get("assemblingline", aOutput, aDuration)) <= 0) { + return false; + } + ItemStack[] tInputs = new ItemStack[aInputs.length]; + ItemStack[][] tAlts = new ItemStack[aInputs.length][]; + for(int i = 0; i < aInputs.length; i++){ + Object obj = aInputs[i]; + if (obj instanceof ItemStack) { + tInputs[i] = (ItemStack) obj; + tAlts[i] = null; + continue; + } else if (obj instanceof ItemStack[]) { + ItemStack[] aStacks = (ItemStack[]) obj; + if (aStacks.length > 0) { + tInputs[i] = aStacks[0]; + tAlts[i] = (ItemStack[]) Arrays.copyOf(aStacks, aStacks.length); + continue; + } + } else if (obj instanceof Object[]) { + Object[] objs = (Object[]) obj; + List<ItemStack> tList; + if (objs.length >= 2 && !(tList = GT_OreDictUnificator.getOres(objs[0])).isEmpty()) { + try { + int tAmount = ((Number) objs[1]).intValue(); + List<ItemStack> uList = new ArrayList<>(); + for (ItemStack tStack : tList) { + ItemStack uStack = GT_Utility.copyAmount(tAmount, tStack); + if (GT_Utility.isStackValid(uStack)) { + uList.add(uStack); + if (tInputs[i] == null) + tInputs[i] = uStack; + } + } + tAlts[i] = uList.toArray(new ItemStack[uList.size()]); + continue; + } catch (Exception t) {} + } + } + GT_FML_LOGGER.info("addAssemblingLineRecipe "+aResearchItem.getDisplayName()+" --> "+aOutput.getUnlocalizedName()+" there is some null item in that recipe"); + } + GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result", new Object[0])}, null, null, aResearchTime, 30, -201); + GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false,tInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result", new Object[0])},aFluidInputs,null,aDuration,aEUt,0,tAlts,true); + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe_AssemblyLine( aResearchItem, aResearchTime, tInputs, aFluidInputs, aOutput, aDuration, aEUt, tAlts)); + return true; } private boolean tryAddTecTechScannerRecipe(ItemStack aResearchItem, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int assDuration, int assEUt) { |