Assembly Line recipe work (Blood Asp)
This commit is contained in:
parent
7c6c34ed0f
commit
857fb7ec02
5 changed files with 111 additions and 54 deletions
|
@ -201,7 +201,7 @@ public interface IGT_RecipeAdder {
|
|||
* @param aDuration must be > 0
|
||||
* @param aEUt should be > 0
|
||||
*/
|
||||
public boolean addAssemblylineRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt);
|
||||
public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt);
|
||||
|
||||
/**
|
||||
* Adds a Forge Hammer Recipe
|
||||
|
|
|
@ -413,6 +413,29 @@ public class GT_Recipe {
|
|||
}
|
||||
|
||||
|
||||
public static class GT_Recipe_AssemblyLine{
|
||||
public static final ArrayList<GT_Recipe_AssemblyLine> sAssemblylineRecipes = new ArrayList<GT_Recipe_AssemblyLine>();
|
||||
|
||||
public ItemStack mResearchItem;
|
||||
public int mResearchTime;
|
||||
public ItemStack[] mInputs;
|
||||
public FluidStack[] mFluidInputs;
|
||||
public ItemStack mOutput;
|
||||
public int mDuration;
|
||||
public int mEUt;
|
||||
|
||||
public GT_Recipe_AssemblyLine(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int aDuration, int aEUt) {
|
||||
mResearchItem = aResearchItem;
|
||||
mResearchTime = aResearchTime;
|
||||
mInputs = aInputs;
|
||||
mFluidInputs = aFluidInputs;
|
||||
mOutput = aOutput;
|
||||
mDuration = aDuration;
|
||||
mEUt = aEUt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class GT_Recipe_Map {
|
||||
/**
|
||||
* Contains all Recipe Maps
|
||||
|
@ -485,7 +508,6 @@ public class GT_Recipe {
|
|||
public static final GT_Recipe_Map_Fuel sSmallNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(10), "gt.recipe.smallnaquadahreactor", "Small Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
|
||||
public static final GT_Recipe_Map_Fuel sLargeNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(10), "gt.recipe.largenaquadahreactor", "Large Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
|
||||
public static final GT_Recipe_Map_Fuel sFluidNaquadahReactorFuels = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(10), "gt.recipe.fluidnaquadahreactor", "Fluid Naquadah Reactor", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true);
|
||||
public static final GT_Recipe_Map sAssemblylineRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(100), "gt.recipe.assemblyline", "Assemblyline", null, RES_PATH_GUI + "basicmachines/Default", 15, 1, 4, 0, 1, E, 1, E, false, false);
|
||||
|
||||
/**
|
||||
* HashMap of Recipes based on their Items
|
||||
|
|
|
@ -8,6 +8,7 @@ import gregtech.api.enums.OrePrefixes;
|
|||
import gregtech.api.interfaces.internal.IGT_RecipeAdder;
|
||||
import gregtech.api.util.GT_ModHandler;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.api.util.GT_Recipe.GT_Recipe_AssemblyLine;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
@ -770,25 +771,25 @@ public class GT_RecipeAdder
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean addAssemblylineRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt) {
|
||||
if ((aInputs == null) || (aOutput1 == null) || aInputs.length>15 || aInputs.length<4) {
|
||||
public boolean addAssemblylineRecipe(ItemStack aResearchItem, int aResearchTime, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput1, int aDuration, int aEUt) {
|
||||
if ((aResearchItem==null)||(aResearchTime<=0)||(aInputs == null) || (aOutput1 == null) || aInputs.length>15 || aInputs.length<4) {
|
||||
return false;
|
||||
}
|
||||
if ((aDuration = GregTech_API.sRecipeFile.get("assemblingline", aOutput1, aDuration)) <= 0) {
|
||||
return false;
|
||||
}
|
||||
String tRecipe = "";
|
||||
for(ItemStack sStack: aInputs){
|
||||
tRecipe += sStack.getItem().getItemStackDisplayName(sStack)+" x"+sStack.stackSize+"; ";
|
||||
}
|
||||
// String tRecipe = "";
|
||||
// for(ItemStack sStack: aInputs){
|
||||
// tRecipe += sStack.getItem().getItemStackDisplayName(sStack)+" x"+sStack.stackSize+"; ";
|
||||
// }
|
||||
//
|
||||
// for(FluidStack sStack: aFluidInputs){
|
||||
// tRecipe += sStack.getLocalizedName()+" "+sStack.amount+"L; ";
|
||||
// }
|
||||
//
|
||||
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput1}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Research result", new Object[0])}, null, null, aResearchTime, 30, 0);
|
||||
|
||||
for(FluidStack sStack: aFluidInputs){
|
||||
tRecipe += sStack.getLocalizedName()+" "+sStack.amount+"L; ";
|
||||
}
|
||||
|
||||
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "tRecipe", new Object[0])}, new ItemStack[]{aOutput1}, null, null, null, aDuration, aEUt, 0);
|
||||
|
||||
GT_Recipe.GT_Recipe_Map.sAssemblylineRecipes.addRecipe(true, aInputs, new ItemStack[]{aOutput1}, null, aFluidInputs, null, aDuration, aEUt, 0);
|
||||
GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe_AssemblyLine( aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput1, aDuration, aEUt));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import gregtech.api.util.GT_OreDictUnificator;
|
|||
import gregtech.api.util.GT_Recipe;
|
||||
import gregtech.api.util.GT_Utility;
|
||||
import gregtech.common.items.behaviors.Behaviour_DataOrb;
|
||||
import gregtech.common.items.behaviors.Behaviour_DataStick;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -147,6 +148,41 @@ public class GT_MetaTileEntity_Scanner
|
|||
|
||||
}
|
||||
}
|
||||
if(ItemList.Tool_DataStick.isStackEqual(getSpecialSlot(), false, true)&& aStack !=null){
|
||||
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()});
|
||||
getSpecialSlot().stackSize -= 1;
|
||||
GT_Utility.ItemNBT.setBookTitle(this.mOutputItems[0], tRecipe.mOutput.getDisplayName()+" Construction Data");
|
||||
|
||||
|
||||
|
||||
NBTTagCompound tNBT = this.mOutputItems[0].getTagCompound();
|
||||
if (tNBT == null) {
|
||||
tNBT = new NBTTagCompound();
|
||||
}
|
||||
tNBT.setTag("output", new NBTTagCompound());
|
||||
tNBT.setInteger("time", tRecipe.mDuration);
|
||||
tNBT.setInteger("eu", tRecipe.mEUt);
|
||||
for(int i = 0 ; i < tRecipe.mInputs.length ; i++){
|
||||
|
||||
tNBT.setTag(""+i, new NBTTagCompound());
|
||||
}
|
||||
for(int i = 0 ; i < tRecipe.mFluidInputs.length ; i++){
|
||||
|
||||
tNBT.setTag("f"+i, new NBTTagCompound());
|
||||
}
|
||||
this.mOutputItems[0].setTagCompound(tNBT);
|
||||
|
||||
aStack.stackSize -= 1;
|
||||
this.mMaxProgresstime = (tRecipe.mResearchTime / (1 << this.mTier - 1));
|
||||
this.mEUt = (30 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
|
||||
getSpecialSlot().stackSize -= 1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1407,9 +1407,7 @@ public class GT_MachineRecipeLoader
|
|||
GT_Values.RA.addCentrifugeRecipe(GT_ModHandler.getModItem("appliedenergistics2", "item.ItemMultiMaterial", 1L, 45), GT_Values.NI, GT_Values.NF, GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.BasalticMineralSand, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Olivine, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Obsidian, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Basalt, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Flint, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.RareEarth, 1L), new int[]{2000, 2000, 2000, 2000, 2000, 2000}, 64, 20);
|
||||
|
||||
//TestRecipe remember to remove!!
|
||||
GT_Values.RA.addAssemblylineRecipe(new ItemStack[]{ItemList.Electric_Motor_IV.get(2, new Object(){}),ItemList.Electric_Piston_IV.get(1, new Object(){}),GT_OreDictUnificator.get(OrePrefixes.stick, Materials.TungstenSteel, 1L)}, new FluidStack[]{Materials.SolderingAlloy.getMolten(144),Materials.Hydrogen.getGas(500)}, ItemList.Robot_Arm_IV.get(2, new Object[]{}), 100, 512);
|
||||
|
||||
GT_Utility.removeSimpleIC2MachineRecipe(new ItemStack(Blocks.cobblestone), GT_ModHandler.getMaceratorRecipeList(), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L));
|
||||
GT_Values.RA.addAssemblylineRecipe(ItemList.Electric_Motor_EV.get(1, new Object(){}),1000,new ItemStack[]{ItemList.Electric_Motor_IV.get(2, new Object(){}),ItemList.Electric_Piston_IV.get(1, new Object(){}),GT_OreDictUnificator.get(OrePrefixes.stick, Materials.TungstenSteel, 1L),GT_OreDictUnificator.get(OrePrefixes.block, Materials.TungstenSteel, 1L),GT_OreDictUnificator.get(OrePrefixes.plate, Materials.TungstenSteel, 1L),GT_OreDictUnificator.get(OrePrefixes.gear, Materials.TungstenSteel, 1L)}, new FluidStack[]{Materials.SolderingAlloy.getMolten(144),Materials.Hydrogen.getGas(500)}, ItemList.Robot_Arm_IV.get(2, new Object[]{}), 100, 480); GT_Utility.removeSimpleIC2MachineRecipe(new ItemStack(Blocks.cobblestone), GT_ModHandler.getMaceratorRecipeList(), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L));
|
||||
GT_Utility.removeSimpleIC2MachineRecipe(GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Lapis, 1L), GT_ModHandler.getMaceratorRecipeList(), ItemList.IC2_Plantball.get(1L, new Object[0]));
|
||||
GT_Utility.removeSimpleIC2MachineRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), GT_ModHandler.getMaceratorRecipeList(), ItemList.IC2_Plantball.get(1L, new Object[0]));
|
||||
GT_Utility.removeSimpleIC2MachineRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), GT_ModHandler.getMaceratorRecipeList(), ItemList.IC2_Plantball.get(1L, new Object[0]));
|
||||
|
|
Loading…
Reference in a new issue