From 4a4f7da15fdea32c54cc54ea847954f383d3a8f4 Mon Sep 17 00:00:00 2001 From: Antifluxfield Date: Sun, 11 Feb 2018 03:50:45 +0800 Subject: [PATCH] Oredict support for AssLine Recipe (#1363) --- .../interfaces/internal/IGT_RecipeAdder.java | 8 ++ .../java/gregtech/api/util/GT_Recipe.java | 37 +++++++ .../java/gregtech/common/GT_RecipeAdder.java | 54 +++++++++++ .../basic/GT_MetaTileEntity_Scanner.java | 30 ++++-- .../multi/GT_MetaTileEntity_AssemblyLine.java | 53 ++++++---- .../postload/GT_MachineRecipeLoader.java | 96 +++++++++---------- .../gregtech/nei/GT_NEI_AssLineHandler.java | 54 ++--------- 7 files changed, 208 insertions(+), 124 deletions(-) diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java index 9d8bca28..863a7631 100644 --- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java +++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java @@ -307,6 +307,14 @@ public interface IGT_RecipeAdder { */ public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, 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. + */ + public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt); + /** * Adds a Forge Hammer Recipe * diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index e0e381be..ab54beda 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -475,8 +475,13 @@ public class GT_Recipe implements Comparable { public ItemStack mOutput; public int mDuration; public int mEUt; + public ItemStack[][] mOreDictAlt; public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) { + this(aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt, new ItemStack[aInputs.length][]); + } + + public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt, ItemStack[][] aAlt) { mResearchItem = aResearchItem; mResearchTime = aResearchTime; mInputs = aInputs; @@ -484,6 +489,7 @@ public class GT_Recipe implements Comparable { mOutput = aOutput; mDuration = aDuration; mEUt = aEUt; + mOreDictAlt = aAlt; } } @@ -672,6 +678,10 @@ public class GT_Recipe implements Comparable { return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue),hidden); } + public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, ItemStack[][] aAlt ,boolean hidden) { + return addFakeRecipe(aCheckForCollisions, new GT_Recipe_WithAlt(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue, aAlt),hidden); + } + /** * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes */ @@ -1652,4 +1662,31 @@ public class GT_Recipe implements Comparable { } } + + public static class GT_Recipe_WithAlt extends GT_Recipe { + + ItemStack[][] mOreDictAlt; + + public GT_Recipe_WithAlt(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue, ItemStack[][] aAlt) { + super(aOptimize, aInputs, aOutputs, aSpecialItems, aChances, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue); + mOreDictAlt = aAlt; + } + + + public Object getAltRepresentativeInput(int aIndex) { + if (aIndex < 0) return null; + if (aIndex < mOreDictAlt.length) { + if (mOreDictAlt[aIndex] != null && mOreDictAlt[aIndex].length > 0) { + ItemStack[] rStacks = new ItemStack[mOreDictAlt[aIndex].length]; + for (int i = 0; i < mOreDictAlt[aIndex].length; i++) { + rStacks[i] = GT_Utility.copy(mOreDictAlt[aIndex][i]); + } + return rStacks; + } + } + if (aIndex >= mInputs.length) return null; + return GT_Utility.copy(mInputs[aIndex]); + } + + } } diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index b3745098..6f3d7eac 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -1,5 +1,9 @@ package gregtech.common; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -1020,6 +1024,56 @@ public class GT_RecipeAdder return true; } + @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 tList; + if (objs.length >= 2 && !(tList = GT_OreDictUnificator.getOres(objs[0])).isEmpty()) { + try { + int tAmount = (int) objs[1]; + List 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) {} + } + } + System.out.println("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, 0); + 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; + } + @Override public boolean addCircuitAssemblerRecipe(ItemStack[] aInputs, FluidStack aFluidInput, ItemStack aOutput, int aDuration, int aEUt) { if ((aInputs == null) || (aOutput == null) || aInputs.length>6 || aInputs.length<1) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java index b7539e63..2cfdf2d1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java @@ -154,7 +154,7 @@ public class GT_MetaTileEntity_Scanner for(GT_Recipe.GT_Recipe_AssemblyLine tRecipe:GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes){ if(GT_Utility.areStacksEqual(tRecipe.mResearchItem, aStack, true)){ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()}); - GT_Utility.ItemNBT.setBookTitle(this.mOutputItems[0], GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName())+" Construction Data"); + GT_Utility.ItemNBT.setBookTitle(this.mOutputItems[0], tRecipe.mOutput.getDisplayName()+" Construction Data"); NBTTagCompound tNBT = this.mOutputItems[0].getTagCompound(); if (tNBT == null) { tNBT = new NBTTagCompound(); @@ -163,24 +163,40 @@ public class GT_MetaTileEntity_Scanner tNBT.setInteger("time", tRecipe.mDuration); tNBT.setInteger("eu", tRecipe.mEUt); for(int i = 0 ; i < tRecipe.mInputs.length ; i++){ - tNBT.setTag(""+i, tRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); } + for(int i = 0 ; i < tRecipe.mOreDictAlt.length ; i++){ + if (tRecipe.mOreDictAlt[i] != null && tRecipe.mOreDictAlt[i].length > 0) { + tNBT.setInteger("a" + i, tRecipe.mOreDictAlt[i].length); + for (int j = 0; j < tRecipe.mOreDictAlt[i].length; j++) { + tNBT.setTag("a" + i + ":" + j, tRecipe.mOreDictAlt[i][j].writeToNBT(new NBTTagCompound())); + } + } + } for(int i = 0 ; i < tRecipe.mFluidInputs.length ; i++){ - tNBT.setTag("f"+i, tRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); } tNBT.setString("author", "Assembly Line Recipe Generator"); NBTTagList tNBTList = new NBTTagList(); - tNBTList.appendTag(new NBTTagString("Constructionplan for "+tRecipe.mOutput.stackSize+" "+GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName())+". Needed EU/t: "+tRecipe.mEUt+" Productiontime: "+(tRecipe.mDuration/20))); + tNBTList.appendTag(new NBTTagString("Constructionplan for "+tRecipe.mOutput.stackSize+" "+ tRecipe.mOutput.getDisplayName()+". Needed EU/t: "+tRecipe.mEUt+" Productiontime: "+(tRecipe.mDuration/20))); for(int i=0;i 0) tNBTList.appendTag(new NBTTagString(tBuilder.toString())); + } else if(tRecipe.mInputs[i]!=null){ + tNBTList.appendTag(new NBTTagString("Input Bus "+(i+1)+": "+tRecipe.mInputs[i].stackSize+" "+ tRecipe.mInputs[i].getDisplayName())); } } for(int i=0;i stackInSlot.stackSize) { - if(GT_Values.D1)System.out.println(i +" not accepted"); - recipeNA = true; - break; - } - if(GT_Values.D1)System.out.println(i+" accepted"); + boolean flag = true; + if (count > 0) { + for (int j = 0; j < count; j++) { + tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j); + if (tStack[i] == null) continue; + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + break; + } + } + } + if (flag) { + tStack[i] = GT_Utility.loadItem(tTag, "" + i); + if (tStack[i] == null) { + flag = false; + continue; + } + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + } + } + if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted")); + if (flag) continue nextDS; } - if (recipeNA) continue; if(GT_Values.D1)System.out.println("All Items done, start fluid check"); for (int i = 0; i < 4; i++) { @@ -115,18 +129,15 @@ public class GT_MetaTileEntity_AssemblyLine if (tFluids[i] == null) continue; if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName()); if (mInputHatches.get(i) == null) { - recipeNA = true; - break; + continue nextDS; } FluidStack fluidInHatch = mInputHatches.get(i).mFluid; if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { if(GT_Values.D1)System.out.println(i+" not accepted"); - recipeNA = true; - break; + continue nextDS; } if(GT_Values.D1)System.out.println(i+" accepted"); } - if (recipeNA) continue; if(GT_Values.D1)System.out.println("Input accepted, check other values"); if (!tTag.hasKey("output")) continue; diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 6297a416..434c29fc 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1982,41 +1982,41 @@ if(Loader.isModLoaded("Railcraft")){ // RobotArm Object o = new Object[0]; - GT_Values.RA.addAssemblylineRecipe(ItemList.Robot_Arm_IV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Robot_Arm_IV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.HSSG, 4L), GT_OreDictUnificator.get(OrePrefixes.gear, Materials.HSSG, 1L), GT_OreDictUnificator.get(OrePrefixes.gearGtSmall, Materials.HSSG, 3L), ItemList.Electric_Motor_LuV.get(2, new Object(){}), ItemList.Electric_Piston_LuV.get(1, new Object(){}), - ItemList.Circuit_Masterquantumcomputer.get(2, o), - ItemList.Circuit_Quantumcomputer.get(2, o), - ItemList.Circuit_Nanoprocessor.get(6,o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, + new Object[]{OrePrefixes.circuit.get(Materials.Elite), 2}, + new Object[]{OrePrefixes.circuit.get(Materials.Data), 6}, GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.YttriumBariumCuprate, 6L)}, new FluidStack[]{ Materials.SolderingAlloy.getMolten(576), Materials.Lubricant.getFluid(250)}, ItemList.Robot_Arm_LuV.get(1, new Object[]{}), 600, 6000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Robot_Arm_LuV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Robot_Arm_LuV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.HSSE, 4L), GT_OreDictUnificator.get(OrePrefixes.gear, Materials.HSSE, 1L), GT_OreDictUnificator.get(OrePrefixes.gearGtSmall, Materials.HSSE, 3L), ItemList.Electric_Motor_ZPM.get(2, new Object(){}), ItemList.Electric_Piston_ZPM.get(1, new Object(){}), - ItemList.Circuit_Masterquantumcomputer.get(4, o), - ItemList.Circuit_Quantumcomputer.get(4, o), - ItemList.Circuit_Nanoprocessor.get(12,o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 4}, + new Object[]{OrePrefixes.circuit.get(Materials.Elite), 4}, + new Object[]{OrePrefixes.circuit.get(Materials.Data), 12}, GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.VanadiumGallium, 6L)}, new FluidStack[]{ Materials.SolderingAlloy.getMolten(1152), Materials.Lubricant.getFluid(750)}, ItemList.Robot_Arm_ZPM.get(1, new Object[]{}), 600, 24000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Robot_Arm_ZPM.get(1, new Object(){}),288000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Robot_Arm_ZPM.get(1, new Object(){}),288000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Neutronium, 4L), GT_OreDictUnificator.get(OrePrefixes.gear, Materials.Neutronium, 1L), GT_OreDictUnificator.get(OrePrefixes.gearGtSmall, Materials.Neutronium, 3L), ItemList.Electric_Motor_UV.get(2, new Object(){}), ItemList.Electric_Piston_UV.get(1, new Object(){}), - ItemList.Circuit_Crystalcomputer.get(8, o), - ItemList.Circuit_Crystalprocessor.get(8, o), - ItemList.Circuit_Nanoprocessor.get(24,o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 8}, + new Object[]{OrePrefixes.circuit.get(Materials.Elite), 8}, + new Object[]{OrePrefixes.circuit.get(Materials.Data), 24}, GT_OreDictUnificator.get(OrePrefixes.cableGt04, Materials.NiobiumTitanium, 6L)}, new FluidStack[]{ Materials.SolderingAlloy.getMolten(2304), Materials.Lubricant.getFluid(2000)}, ItemList.Robot_Arm_UV.get(1, new Object[]{}), 600, 100000); @@ -2024,12 +2024,12 @@ if(Loader.isModLoaded("Railcraft")){ // Emitter - GT_Values.RA.addAssemblylineRecipe(ItemList.Emitter_IV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Emitter_IV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.HSSG, 1L), ItemList.Emitter_IV.get(1, new Object(){}), ItemList.Emitter_EV.get(2, new Object(){}), ItemList.Emitter_HV.get(4, new Object(){}), - ItemList.Circuit_Nanoprocessor.get(7,o), + new Object[]{OrePrefixes.circuit.get(Materials.Data), 7}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 64L), @@ -2037,12 +2037,12 @@ if(Loader.isModLoaded("Railcraft")){ Materials.SolderingAlloy.getMolten(576)}, ItemList.Emitter_LuV.get(1, new Object[]{}), 600, 6000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Emitter_LuV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Emitter_LuV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.HSSE, 1L), ItemList.Emitter_LuV.get(1, new Object(){}), ItemList.Emitter_IV.get(2, new Object(){}), ItemList.Emitter_EV.get(4, new Object(){}), - ItemList.Circuit_Quantumcomputer.get(7, o), + new Object[]{OrePrefixes.circuit.get(Materials.Elite), 7}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Platinum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Platinum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Platinum, 64L), @@ -2050,12 +2050,12 @@ if(Loader.isModLoaded("Railcraft")){ Materials.SolderingAlloy.getMolten(576)}, ItemList.Emitter_ZPM.get(1, new Object[]{}), 600, 24000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Emitter_ZPM.get(1, new Object(){}),288000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Emitter_ZPM.get(1, new Object(){}),288000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 1L), ItemList.Emitter_ZPM.get(1, new Object(){}), ItemList.Emitter_LuV.get(2, new Object(){}), ItemList.Emitter_IV.get(4, new Object(){}), - ItemList.Circuit_Crystalcomputer.get(7, o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 7}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 64L), @@ -2065,12 +2065,12 @@ if(Loader.isModLoaded("Railcraft")){ // Sensor - GT_Values.RA.addAssemblylineRecipe(ItemList.Sensor_IV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Sensor_IV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.HSSG, 1L), ItemList.Sensor_IV.get(1, new Object(){}), ItemList.Sensor_EV.get(2, new Object(){}), ItemList.Sensor_HV.get(4, new Object(){}), - ItemList.Circuit_Nanoprocessor.get(7,o), + new Object[]{OrePrefixes.circuit.get(Materials.Data), 7}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Electrum, 64L), @@ -2078,12 +2078,12 @@ if(Loader.isModLoaded("Railcraft")){ Materials.SolderingAlloy.getMolten(576)}, ItemList.Sensor_LuV.get(1, new Object[]{}), 600, 6000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Sensor_LuV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Sensor_LuV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.HSSE, 1L), ItemList.Sensor_LuV.get(1, new Object(){}), ItemList.Sensor_IV.get(2, new Object(){}), ItemList.Sensor_EV.get(4, new Object(){}), - ItemList.Circuit_Quantumcomputer.get(7, o), + new Object[]{OrePrefixes.circuit.get(Materials.Elite), 7}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Platinum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Platinum, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Platinum, 64L), @@ -2091,12 +2091,12 @@ if(Loader.isModLoaded("Railcraft")){ Materials.SolderingAlloy.getMolten(576)}, ItemList.Sensor_ZPM.get(1, new Object[]{}), 600, 24000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Sensor_ZPM.get(1, new Object(){}),288000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Sensor_ZPM.get(1, new Object(){}),288000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 1L), ItemList.Sensor_ZPM.get(1, new Object(){}), ItemList.Sensor_LuV.get(2, new Object(){}), ItemList.Sensor_IV.get(4, new Object(){}), - ItemList.Circuit_Crystalcomputer.get(7, o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 7}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 64L), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Osmiridium, 64L), @@ -2106,12 +2106,12 @@ if(Loader.isModLoaded("Railcraft")){ // Field Generator - GT_Values.RA.addAssemblylineRecipe(ItemList.Field_Generator_IV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Field_Generator_IV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.HSSG, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.HSSG, 6L), ItemList.QuantumStar.get(1, new Object(){}), ItemList.Emitter_LuV.get(4, new Object(){}), - ItemList.Circuit_Masterquantumcomputer.get(8, o), + new ItemStack[]{ItemList.Circuit_Masterquantumcomputer.get(8, o), ItemList.Circuit_Crystalcomputer.get(8, o), ItemList.Circuit_Neuroprocessor.get(8, o)}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Osmium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Osmium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Osmium, 64L), @@ -2120,12 +2120,12 @@ if(Loader.isModLoaded("Railcraft")){ Materials.SolderingAlloy.getMolten(576)}, ItemList.Field_Generator_LuV.get(1, new Object[]{}), 600, 6000); - GT_Values.RA.addAssemblylineRecipe(ItemList.Field_Generator_LuV.get(1, new Object(){}),144000,new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(ItemList.Field_Generator_LuV.get(1, new Object(){}),144000,new Object[]{ GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.HSSE, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.HSSE, 6L), ItemList.QuantumStar.get(4, new Object(){}), ItemList.Emitter_ZPM.get(4, new Object(){}), - ItemList.Circuit_Crystalcomputer.get(16, o), + new ItemStack[]{ItemList.Circuit_Crystalcomputer.get(16, o), ItemList.Circuit_Neuroprocessor.get(16, o)}, GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Osmium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Osmium, 64L), GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Osmium, 64L), @@ -2158,9 +2158,9 @@ if(Loader.isModLoaded("Railcraft")){ // Quantumsuite GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item("quantumHelmet", 1L)); - GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("nanoHelmet", 1L, GT_Values.W), 144000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("nanoHelmet", 1L, GT_Values.W), 144000, new Object[]{ GT_ModHandler.getIC2Item("nanoHelmet", 1L, GT_Values.W), - ItemList.Circuit_Masterquantumcomputer.get(2, o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, GT_OreDictUnificator.get(OrePrefixes.plateAlloy, Materials.Iridium, 4), ItemList.Energy_LapotronicOrb.get(1, new Object[]{}), ItemList.Sensor_IV.get(1, new Object[]{}), @@ -2172,9 +2172,9 @@ if(Loader.isModLoaded("Railcraft")){ }, GT_ModHandler.getIC2Item("quantumHelmet", 1L), 1500, 4096); GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item("quantumBodyarmor", 1L)); - GT_Values.RA.addAssemblylineRecipe(Loader.isModLoaded("GraviSuite") ? GT_ModHandler.getModItem("GraviSuite", "advNanoChestPlate", 1, GT_Values.W) : GT_ModHandler.getIC2Item("nanoBodyarmor", 1L, GT_Values.W), 144000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(Loader.isModLoaded("GraviSuite") ? GT_ModHandler.getModItem("GraviSuite", "advNanoChestPlate", 1, GT_Values.W) : GT_ModHandler.getIC2Item("nanoBodyarmor", 1L, GT_Values.W), 144000, new Object[]{ Loader.isModLoaded("GraviSuite") ? GT_ModHandler.getModItem("GraviSuite", "advNanoChestPlate", 1, GT_Values.W) : GT_ModHandler.getIC2Item("nanoBodyarmor", 1L, GT_Values.W), - ItemList.Circuit_Masterquantumcomputer.get(2, o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, GT_OreDictUnificator.get(OrePrefixes.plateAlloy, Materials.Iridium, 6), ItemList.Energy_LapotronicOrb.get(1, new Object[]{}), ItemList.Field_Generator_HV.get(2, new Object[]{}), @@ -2186,9 +2186,9 @@ if(Loader.isModLoaded("Railcraft")){ }, GT_ModHandler.getIC2Item("quantumBodyarmor", 1L), 1500, 4096); GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item("quantumLeggings", 1L)); - GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("nanoLeggings", 1L, GT_Values.W), 144000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("nanoLeggings", 1L, GT_Values.W), 144000, new Object[]{ GT_ModHandler.getIC2Item("nanoLeggings", 1L, GT_Values.W), - ItemList.Circuit_Masterquantumcomputer.get(2, o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, GT_OreDictUnificator.get(OrePrefixes.plateAlloy, Materials.Iridium, 6), ItemList.Energy_LapotronicOrb.get(1, new Object[]{}), ItemList.Field_Generator_HV.get(2, new Object[]{}), @@ -2200,9 +2200,9 @@ if(Loader.isModLoaded("Railcraft")){ }, GT_ModHandler.getIC2Item("quantumLeggings", 1L), 1500, 4096); GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getIC2Item("quantumBoots", 1L)); - GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("nanoBoots", 1L, GT_Values.W), 144000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("nanoBoots", 1L, GT_Values.W), 144000, new Object[]{ GT_ModHandler.getIC2Item("nanoBoots", 1L, GT_Values.W), - ItemList.Circuit_Masterquantumcomputer.get(2, o), + new Object[]{OrePrefixes.circuit.get(Materials.Master), 2}, GT_OreDictUnificator.get(OrePrefixes.plateAlloy, Materials.Iridium, 4), ItemList.Energy_LapotronicOrb.get(1, new Object[]{}), ItemList.Field_Generator_HV.get(1, new Object[]{}), @@ -2215,10 +2215,10 @@ if(Loader.isModLoaded("Railcraft")){ if(Loader.isModLoaded("GraviSuite")){ GT_ModHandler.removeRecipeByOutput(GT_ModHandler.getModItem("GraviSuite", "graviChestPlate", 1, GT_Values.W)); - GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("quantumBodyarmor", 1L, GT_Values.W), 144000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(GT_ModHandler.getIC2Item("quantumBodyarmor", 1L, GT_Values.W), 144000, new Object[]{ GT_ModHandler.getIC2Item("quantumBodyarmor", 1L, GT_Values.W), GT_ModHandler.getModItem("GraviSuite", "ultimateLappack", 1, GT_Values.W), - ItemList.Circuit_Ultimatecrystalcomputer.get(2, o), + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 2}, GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Duranium, 6), ItemList.Energy_LapotronicOrb2.get(1, new Object[]{}), ItemList.Field_Generator_IV.get(2, new Object[]{}), @@ -2347,12 +2347,12 @@ if(Loader.isModLoaded("Railcraft")){ GregTech_API.mIC2Classic ? Materials.Water.getFluid(16000) : new FluidStack(FluidRegistry.getFluid("ic2coolant"), 16000) }, ItemList.ZPM2.get(1, o), 2000, 300000); } - GT_Values.RA.addAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 1), 144000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.wireGt01, Materials.Superconductor, 1), 144000, new Object[]{ ItemList.Casing_Fusion_Coil.get(1,o), - ItemList.Circuit_Quantummainframe.get(1,o), - ItemList.Circuit_Quantummainframe.get(1,o), - ItemList.Circuit_Quantummainframe.get(1,o), - ItemList.Circuit_Quantummainframe.get(1,o), + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Ultimate), 1}, GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Plutonium241, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.NetherStar, 1L), ItemList.Field_Generator_IV.get(2,o), @@ -2362,12 +2362,12 @@ if(Loader.isModLoaded("Railcraft")){ Materials.SolderingAlloy.getMolten(2880), }, ItemList.FusionComputer_LuV.get(1,o), 1000, 30000); - GT_Values.RA.addAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.block, Materials.Europium, 1), 288000, new ItemStack[]{ + GT_Values.RA.addAssemblylineRecipe(GT_OreDictUnificator.get(OrePrefixes.block, Materials.Europium, 1), 288000, new Object[]{ ItemList.Casing_Fusion_Coil.get(1,o), - ItemList.Circuit_Crystalmainframe.get(1,o), - ItemList.Circuit_Crystalmainframe.get(1,o), - ItemList.Circuit_Crystalmainframe.get(1,o), - ItemList.Circuit_Crystalmainframe.get(1,o), + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, + new Object[]{OrePrefixes.circuit.get(Materials.Superconductor), 1}, GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Europium, 4L), ItemList.Field_Generator_LuV.get(2,o), ItemList.Circuit_Wafer_HPIC.get(48,o), diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java index a2fad03c..af899398 100644 --- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java @@ -18,6 +18,7 @@ import gregtech.api.objects.ItemData; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_WithAlt; import gregtech.api.util.GT_Utility; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; @@ -160,7 +161,6 @@ public class GT_NEI_AssLineHandler } } } - CachedDefaultRecipe tNEIRecipe; } public String getOverlayIdentifier() { @@ -374,53 +374,11 @@ public class GT_NEI_AssLineHandler super(); this.mRecipe = aRecipe; - if (aRecipe.getRepresentativeInput(0) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(0), 12, 0)); - } - if (aRecipe.getRepresentativeInput(1) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(1), 30, 0)); - } - if (aRecipe.getRepresentativeInput(2) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(2), 48, 0)); - } - if (aRecipe.getRepresentativeInput(3) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(3), 66, 0)); - } - if (aRecipe.getRepresentativeInput(4) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(4), 12, 18)); - } - if (aRecipe.getRepresentativeInput(5) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(5), 30, 18)); - } - if (aRecipe.getRepresentativeInput(6) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(6), 48, 18)); - } - if (aRecipe.getRepresentativeInput(7) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(7), 66, 18)); - } - if (aRecipe.getRepresentativeInput(8) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(8), 12,36)); - } - if (aRecipe.getRepresentativeInput(9) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(9), 30,36)); - } - if (aRecipe.getRepresentativeInput(10) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(10),48, 36)); - } - if (aRecipe.getRepresentativeInput(11) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(11),66, 36)); - } - if (aRecipe.getRepresentativeInput(12) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(12), 12, 54)); - } - if (aRecipe.getRepresentativeInput(13) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(13), 30, 54)); - } - if (aRecipe.getRepresentativeInput(14) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(14), 48, 54)); - } - if (aRecipe.getRepresentativeInput(15) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(15), 66, 54)); + for (int i = 0; i < 16; i++) { + Object obj = aRecipe instanceof GT_Recipe_WithAlt ? ((GT_Recipe_WithAlt) aRecipe).getAltRepresentativeInput(i) : aRecipe.getRepresentativeInput(i); + if (obj != null) { + this.mInputs.add(new FixedPositionedStack(obj, 18 * (i % 4) + 12, 18 * (i / 4))); + } } if (aRecipe.mSpecialItems != null) {