diff options
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/GT_RecipeAdder.java | 89 | ||||
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java | 36 |
2 files changed, 81 insertions, 44 deletions
diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index 5a036a6648..71e8644d11 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -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; @@ -114,11 +115,11 @@ public class GT_RecipeAdder new GT_Recipe(aInput1, aEUt, aInput2, aDuration, aOutput1, aOutput2); return true; } - - @Override - public boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt) { - return addAlloySmelterRecipe(aInput1, aInput2, aOutput1, aDuration, aEUt, false); - } + + @Override + public boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt) { + return addAlloySmelterRecipe(aInput1, aInput2, aOutput1, aDuration, aEUt, false); + } public boolean addAlloySmelterRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput1, int aDuration, int aEUt, boolean hidden) { if ((aInput1 == null) || (aOutput1 == null || Materials.Graphite.contains(aInput1))) { @@ -131,7 +132,7 @@ public class GT_RecipeAdder return false; } GT_Recipe tRecipe =new GT_Recipe(aInput1, aInput2, aEUt, aDuration, aOutput1); - if ((hidden) && (tRecipe != null)) { + if ((hidden) && (tRecipe != null)) { tRecipe.mHidden = true; } return true; @@ -273,14 +274,14 @@ public class GT_RecipeAdder int tITNT = Math.max(1, tExplosives/4); //new GT_Recipe(aInput1, aInput2, aOutput1, aOutput2); if(tGunpowder<65){ - GT_Recipe.GT_Recipe_Map.sImplosionRecipes.addRecipe(true, new ItemStack[]{aInput1, ItemList.Block_Powderbarrel.get(tGunpowder, new Object[0])}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, 20, 30, 0); + GT_Recipe.GT_Recipe_Map.sImplosionRecipes.addRecipe(true, new ItemStack[]{aInput1, ItemList.Block_Powderbarrel.get(tGunpowder, new Object[0])}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, 20, 30, 0); } if(tDynamite<17){ - GT_Recipe.GT_Recipe_Map.sImplosionRecipes.addRecipe(true, new ItemStack[]{aInput1, GT_ModHandler.getIC2Item("dynamite", tDynamite, null)}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, 20, 30, 0); + GT_Recipe.GT_Recipe_Map.sImplosionRecipes.addRecipe(true, new ItemStack[]{aInput1, GT_ModHandler.getIC2Item("dynamite", tDynamite, null)}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, 20, 30, 0); } GT_Recipe.GT_Recipe_Map.sImplosionRecipes.addRecipe(true, new ItemStack[]{aInput1, new ItemStack(Blocks.tnt,tTNT)}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, 20, 30, 0); GT_Recipe.GT_Recipe_Map.sImplosionRecipes.addRecipe(true, new ItemStack[]{aInput1, GT_ModHandler.getIC2Item("industrialTnt", tITNT, null)}, new ItemStack[]{aOutput1, aOutput2}, null, null, null, null, 20, 30, 0); - + return true; } @@ -472,11 +473,11 @@ public class GT_RecipeAdder GT_Recipe.GT_Recipe_Map.sFluidSolidficationRecipes.addRecipe(true, new ItemStack[]{aMold}, new ItemStack[]{aOutput}, null, new FluidStack[]{aInput}, null, aDuration, aEUt, 0); return true; } - - @Override - public boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt) { - return addFluidSmelterRecipe(aInput, aRemains, aOutput, aChance, aDuration, aEUt, false); - } + + @Override + public boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt) { + return addFluidSmelterRecipe(aInput, aRemains, aOutput, aChance, aDuration, aEUt, false); + } public boolean addFluidSmelterRecipe(ItemStack aInput, ItemStack aRemains, FluidStack aOutput, int aChance, int aDuration, int aEUt, boolean hidden) { if ((aInput == null) || (aOutput == null)) { @@ -493,7 +494,7 @@ public class GT_RecipeAdder } GT_Recipe tRecipe =GT_Recipe.GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aRemains}, null, new int[]{aChance}, null, new FluidStack[]{aOutput}, aDuration, aEUt, 0); if ((hidden) && (tRecipe != null)) { - tRecipe.mHidden = true; + tRecipe.mHidden = true; } return true; } @@ -635,12 +636,12 @@ public class GT_RecipeAdder } return false; } - - @Override - public boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt) { - return addArcFurnaceRecipe(aInput, aOutputs, aChances, aDuration, aEUt, false); - } + + @Override + public boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt) { + return addArcFurnaceRecipe(aInput, aOutputs, aChances, aDuration, aEUt, false); + } public boolean addArcFurnaceRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden) { if ((aInput == null) || (aOutputs == null)) { @@ -653,14 +654,14 @@ public class GT_RecipeAdder } GT_Recipe sRecipe = GT_Recipe.GT_Recipe_Map.sArcFurnaceRecipes.addRecipe(true, new ItemStack[]{aInput}, aOutputs, null, aChances, new FluidStack[]{Materials.Oxygen.getGas(aDuration)}, null, Math.max(1, aDuration), Math.max(1, aEUt), 0); if ((hidden) && (sRecipe != null)) { - sRecipe.mHidden = true; + sRecipe.mHidden = true; } for (Materials tMaterial : new Materials[]{Materials.Argon, Materials.Nitrogen}) { if (tMaterial.mPlasma != null) { int tPlasmaAmount = (int) Math.max(1L, aDuration / (tMaterial.getMass() * 16L)); GT_Recipe tRecipe =GT_Recipe.GT_Recipe_Map.sPlasmaArcFurnaceRecipes.addRecipe(true, new ItemStack[]{aInput}, aOutputs, null, aChances, new FluidStack[]{tMaterial.getPlasma(tPlasmaAmount)}, new FluidStack[]{tMaterial.getGas(tPlasmaAmount)}, Math.max(1, aDuration / 16), Math.max(1, aEUt / 3), 0); if ((hidden) && (tRecipe != null)) { - tRecipe.mHidden = true; + tRecipe.mHidden = true; } } } @@ -717,12 +718,12 @@ public class GT_RecipeAdder } return false; } - - @Override - public boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt) { - return addPulveriserRecipe(aInput, aOutputs, aChances, aDuration, aEUt, false); - } + + @Override + public boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt) { + return addPulveriserRecipe(aInput, aOutputs, aChances, aDuration, aEUt, false); + } public boolean addPulveriserRecipe(ItemStack aInput, ItemStack[] aOutputs, int[] aChances, int aDuration, int aEUt, boolean hidden) { if ((aInput == null) || (aOutputs == null)) { @@ -735,7 +736,7 @@ public class GT_RecipeAdder } GT_Recipe tRecipe =GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.addRecipe(true, new ItemStack[]{aInput}, aOutputs, null, aChances, null, null, aDuration, aEUt, 0); if ((hidden) && (tRecipe != null)) { - tRecipe.mHidden = true; + tRecipe.mHidden = true; } return true; } @@ -769,28 +770,28 @@ public class GT_RecipeAdder return true; } - @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) { + @Override + 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+"; "; - } - - 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); +// 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); + + GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe_AssemblyLine( aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput1, aDuration, aEUt)); return true; - } + } 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 90746e3fbd..857d2c5703 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 @@ -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; |