diff options
author | draknyte1 <draknyte1@hotmail.com> | 2016-11-02 15:49:00 +1000 |
---|---|---|
committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-02 15:49:00 +1000 |
commit | d594987b2cfdefa447ee585a68d4a4bef4ece3a5 (patch) | |
tree | 814813fc14ce5dcd8dfa7aeaecd939ac42d12877 /src/Java/gtPlusPlus/xmod/gregtech/loaders | |
parent | 26292158575a0f0acb51ae50715887f871d2b5a0 (diff) | |
parent | 49a520da5da01594b5c42652d9db5c7c04e49ad8 (diff) | |
download | GT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.tar.gz GT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.tar.bz2 GT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.zip |
Merge branch 'master' of https://github.com/draknyte1/GTplusplus
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders')
8 files changed, 1044 insertions, 2 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java new file mode 100644 index 0000000000..8a92d34a8e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -0,0 +1,41 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.registry.GameRegistry; + +public class Gregtech_Blocks { + + public static void run(){ + + //Casing Blocks + ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); + //ModBlocks.blockMetaTileEntity = new GregtechBlockMachines(); + //registerDefailtGtTe(); + + + + + } + + //Register default Tile Entity + private static void registerDefailtGtTe(){ + Utils.LOG_INFO("Registering new GT TileEntities."); + + BaseMetaTileEntity tBaseMetaTileEntity = Meta_GT_Proxy.constructBaseMetaTileEntity(); + + Utils.LOG_INFO("Testing BaseMetaTileEntity."); + if (tBaseMetaTileEntity == null) { + Utils.LOG_INFO("Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + throw new RuntimeException(""); + } + Utils.LOG_INFO("Registering the BaseMetaTileEntityEx."); + GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntityEx"); + FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial", tBaseMetaTileEntity.getClass().getName()); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java index fe27c09fef..b34aead51e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java @@ -7,7 +7,7 @@ import gregtech.api.enums.ToolDictNames; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; @@ -56,7 +56,7 @@ public class ProcessingToolHeadChoocher implements Interface_OreRecipeRegistrato ItemStack hammerhead = GT_OreDictUnificator.get(OrePrefixes.toolHeadHammer, aMaterial, 1L); if (null != plate && null != ingot && null != hammerhead && null != longrod && null != screw){ - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( hammerhead, ToolDictNames.craftingToolScrewdriver.name(), plate, ingot, plate, plate, longrod, screw, null, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java new file mode 100644 index 0000000000..42f3829045 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -0,0 +1,230 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; + +import java.util.ArrayList; + +import net.minecraft.item.ItemStack; + +public class RecipeGen_BlastSmelter implements Runnable{ + + final Material toGenerate; + + public RecipeGen_BlastSmelter(final Material M){ + this.toGenerate = M; + } + + @Override + public void run() { + generateARecipe(toGenerate); + } + + public static void generateARecipe(final Material M){ + + //Add a Blast Smelting Recipe, Let's go! + ItemStack tStack; + if (null != (tStack = M.getDust(1))) { + + //Prepare some Variables + ItemStack[] components; + ArrayList<MaterialStack> tMaterial = new ArrayList<MaterialStack>(); + short counter=0; + int inputStackCount=0; + int fluidAmount=0; + boolean doTest = true; + tMaterial = M.getComposites(); + + //This Bad boy here is what dictates unique recipes. Fuck life, right? + ItemStack circuitGT = ItemUtils.getGregtechCircuit(0); + + + //Set a duration + int duration = 0; + if (M.getMeltingPointK() > 150){ + duration = (int) Math.max(M.getMass() / 50L, 1L) * M.getMeltingPointK(); + } + else { + duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; + } + + + int mMaterialListSize=0; + if (M.getComposites() != null){ + for (gtPlusPlus.core.material.MaterialStack ternkfsdf : M.getComposites()){ + if (ternkfsdf != null) + mMaterialListSize++; + } + } + else { + mMaterialListSize = 1; + } + + Utils.LOG_WARNING("Size: "+mMaterialListSize); + + + //Make a simple one Material Materialstack[] and log it for validity. + circuitGT = ItemUtils.getGregtechCircuit(1); + ItemStack[] tItemStackTest = new ItemStack[]{circuitGT, tStack}; + inputStackCount = 1; + fluidAmount = 144*inputStackCount; + Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+". Gives "+fluidAmount+"L of molten metal."); + for (int das=0;das<tItemStackTest.length;das++){ + if (tItemStackTest[das] != null) + Utils.LOG_WARNING("tMaterial["+das+"]: "+tItemStackTest[das].getDisplayName()+" Meta: "+tItemStackTest[das].getItemDamage()+", Amount: "+tItemStackTest[das].stackSize); + } + + boolean hasMoreInputThanACircuit = (tItemStackTest.length > 1); + + //Generate Recipes for all singular materials that can be made molten. + if (hasMoreInputThanACircuit){ + if (M.requiresBlastFurnace()) { + if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration, 240)){ + Utils.LOG_WARNING("Success."); + if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration, 120)){ + Utils.LOG_INFO("Success, Also added a Fluid solidifier recipe."); + if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration, 120)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + if (GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1), null, M.getFluid(16), 100, duration/9, 120)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/4, 120)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/9, 120)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + } + } + } + else { + Utils.LOG_WARNING("Failed."); + } + } + else { + if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration/2, 120)){ + Utils.LOG_WARNING("Success."); + if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration/2, 60)){ + Utils.LOG_INFO("Success, Also added a Fluid solidifier recipe."); + if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration/2, 60)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + ItemStack tempitem = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nugget"+M.getUnlocalizedName(), 1); + if (tempitem != null){ + if (GT_Values.RA.addFluidExtractionRecipe(tempitem, null, M.getFluid(16), 100, duration/2/9, 60)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + } + if (GT_Values.RA.addFluidExtractionRecipe(M.getSmallDust(1), null, M.getFluid(36), 100, duration/2/4, 60)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + if (GT_Values.RA.addFluidExtractionRecipe(M.getTinyDust(1), null, M.getFluid(16), 100, duration/2/9, 60)){ + Utils.LOG_INFO("Success, Also added a Fluid Extractor recipe."); + } + } + } + else { + Utils.LOG_WARNING("Failed."); + } + } + + if (tMaterial != null){ + //Reset the Variables for compounds if last recipe was a success. + inputStackCount=0; + counter=0; + + + + //If this Material has some kind of compound list, proceed + if (mMaterialListSize > 1){ + gtPlusPlus.core.material.MaterialStack[] tempStack = new gtPlusPlus.core.material.MaterialStack[mMaterialListSize]; + circuitGT = ItemUtils.getGregtechCircuit(mMaterialListSize); + //Just double checking + if (tempStack.length > 1){ + + //Builds me a MaterialStack[] from the MaterialList of M. + int ooo=0; + for (gtPlusPlus.core.material.MaterialStack xMaterial : M.getComposites()){ + if (xMaterial != null){ + if (xMaterial.getStackMaterial() != null){ + Utils.LOG_WARNING("FOUND: "+xMaterial.getStackMaterial().getLocalizedName()); + Utils.LOG_WARNING("ADDING: "+xMaterial.getStackMaterial().getLocalizedName()); + } + tempStack[ooo] = xMaterial; + } + ooo++; + } + + //Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for the 144L fluid multiplier + components = new ItemStack[9]; + inputStackCount=0; + for (int irc=0;irc<M.getComposites().size();irc++){ + if (M.getComposites().get(irc) != null){ + int r = (int) M.vSmallestRatio[irc]; + inputStackCount = inputStackCount+r; + components[irc] = M.getComposites().get(irc).getDustStack(r); + } + } + + + //Adds a circuit + if (mMaterialListSize < 9 && mMaterialListSize != 0){ + ItemStack[] components_NoCircuit = components; + //Builds me an ItemStack[] of the materials. - With a circuit + components = new ItemStack[components_NoCircuit.length+1]; + for (int fr=0;fr<components.length;fr++){ + if (fr==0){ + components[0] = circuitGT; + } + else { + components[fr] = components_NoCircuit[fr-1]; + } + } + Utils.LOG_INFO("Should have added a circuit. mMaterialListSize: "+mMaterialListSize+" | circuit: "+components[0].getDisplayName()); + } + else { + Utils.LOG_INFO("Did not add a circuit. mMaterialListSize: "+mMaterialListSize); + } + + //Set Fluid output + fluidAmount = 144*inputStackCount; + + Utils.LOG_INFO("Adding an Alloy Blast Smelter Recipe for "+M.getLocalizedName()+" using it's compound dusts. This material has "+ inputStackCount+" parts. Gives "+fluidAmount+"L of molten metal."); + Utils.LOG_INFO("tMaterial.length: "+components.length+"."); + for (int das=0;das<components.length;das++){ + if (components[das] != null) + Utils.LOG_INFO("tMaterial["+das+"]: "+components[das].getDisplayName()+" Meta: "+components[das].getItemDamage()+", Amount: "+components[das].stackSize); + } + + //Adds Recipe + if (M.requiresBlastFurnace()) { + if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 500)){ + Utils.LOG_WARNING("Success."); + } + else { + Utils.LOG_WARNING("Failed."); + } + } + else { + if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 240)){ + Utils.LOG_WARNING("Success."); + } + else { + Utils.LOG_WARNING("Failed."); + } + } + } + } + } + else { + Utils.LOG_WARNING("doTest: "+doTest+" | tMaterial != null: "+(tMaterial != null)); + } + } + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java new file mode 100644 index 0000000000..be2dbff77a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java @@ -0,0 +1,172 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.objects.MaterialStack; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_BlastSmelterGT implements Runnable{ + + public RecipeGen_BlastSmelterGT(){ + + } + + @Override + public void run() { + generateRecipes(); + } + + public static void generateRecipes(){ + + Materials[] GregMaterials = Materials.values(); + + for (Materials M : GregMaterials){ + + if (M.equals(Materials.Iridium) || M.equals(Materials.Osmium) || M.equals(Materials.Osmiridium) + || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) + || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) + || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) + || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) || !M.equals(Materials.Osmiridium) + ){ + + + //Add a Blast Smelting Recipe, Let's go! + ItemStack tStack; + if ((null != (tStack = GT_OreDictUnificator.get(OrePrefixes.ingot, M.mSmeltInto, 1L))) && (!M.contains(SubTag.NO_SMELTING) && (M.contains(SubTag.METAL)))) { + + //Prepare some Variables + ItemStack[] components; + MaterialStack[] tMaterial; + short counter=0; + int inputStackCount=0; + int fluidAmount=0; + boolean doTest = true; + + //This Bad boy here is what dictates unique recipes. Fuck life, right? + ItemStack circuitGT = ItemUtils.getGregtechCircuit(0); + + + //Set a duration + int duration = 0; + if (M.mBlastFurnaceTemp > 150){ + duration = (int) Math.max(M.getMass() / 50L, 1L) * M.mBlastFurnaceTemp; + } + else { + duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; + } + + + //Make a simple one Material Materialstack[] and log it for validity. + tMaterial = new MaterialStack[]{new MaterialStack(M, 1)}; + circuitGT = ItemUtils.getGregtechCircuit(1); + ItemStack[] tItemStackTest = new ItemStack[]{circuitGT, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+M, 1)}; + inputStackCount = 1; + fluidAmount = 144*inputStackCount; + Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M+". Gives "+fluidAmount+"L of molten metal."); + Utils.LOG_WARNING("tMaterial.length: "+tMaterial.length+"."); + for (int das=0;das<tItemStackTest.length;das++){ + if (tItemStackTest[das] != null) + Utils.LOG_WARNING("tMaterial["+das+"]: "+tItemStackTest[das].getDisplayName()+" Meta: "+tItemStackTest[das].getItemDamage()+", Amount: "+tItemStackTest[das].stackSize); + } + + //Generate Recipes for all singular materials that can be made molten. + if (M.mBlastFurnaceRequired) { + doTest = CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getMolten(fluidAmount), 100, duration, 240); + } + else { + doTest = CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getMolten(fluidAmount), 100, duration/2, 120); + } + + if (doTest){ + //Reset the Variables for compounds if last recipe was a success. + inputStackCount=0; + counter=0; + + + int mMaterialListSize=0; + for (MaterialStack ternkfsdf:M.mMaterialList){ + mMaterialListSize++; + } + Utils.LOG_WARNING("Size: "+mMaterialListSize); + //If this Material has some kind of compound list, proceed + if (mMaterialListSize > 1){ + MaterialStack[] tempStack = new MaterialStack[mMaterialListSize]; + circuitGT = ItemUtils.getGregtechCircuit(mMaterialListSize); + //Just double checking + if (tempStack.length > 1){ + + //Builds me a MaterialStack[] from the MaterialList of M. + int ooo=0; + for (MaterialStack xMaterial : M.mMaterialList){ + Utils.LOG_WARNING("FOUND: "+xMaterial.mMaterial); + Utils.LOG_WARNING("ADDING: "+xMaterial.mMaterial); + tempStack[ooo] = M.mMaterialList.get(ooo); + ooo++; + } + + //Builds me an ItemStack[] of the materials. - Without a circuit - this gets a good count for the 144L fluid multiplier + components = new ItemStack[tempStack.length]; + for (MaterialStack aOutputPart : tempStack){ + if (aOutputPart != null){ + Utils.LOG_WARNING("Finding dust: "+aOutputPart.mMaterial); + ItemStack rStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+aOutputPart.mMaterial, (int) aOutputPart.mAmount); + if (rStack != null){ + Utils.LOG_WARNING("Found dust: "+aOutputPart.mMaterial); + components[counter] = rStack; + inputStackCount = inputStackCount+rStack.stackSize; + } + } + counter++; + } + + + if (mMaterialListSize > 0 && mMaterialListSize < 9){ + ItemStack[] components_NoCircuit = components; + //Builds me an ItemStack[] of the materials. - With a circuit + components = new ItemStack[components_NoCircuit.length+1]; + for (int fr=0;fr<components.length;fr++){ + if (fr==0){ + components[0] = circuitGT; + } + else { + components[fr] = components_NoCircuit[fr-1]; + } + } + } + + /*//Add a shapeless recipe for each dust this way - Compat mode. + ItemStack outputStack = tStack; + outputStack.stackSize = mMaterialListSize; + RecipeUtils.buildShapelessRecipe(outputStack, components);*/ + + + + //Set Fluid output + fluidAmount = 144*inputStackCount; + + + Utils.LOG_WARNING("Adding an Alloy Blast Smelter Recipe for "+M+" using it's compound dusts. This material has "+ inputStackCount+" parts. Gives "+fluidAmount+"L of molten metal."); + Utils.LOG_WARNING("tMaterial.length: "+components.length+"."); + for (int das=0;das<components.length;das++){ + if (components[das] != null) + Utils.LOG_WARNING("tMaterial["+das+"]: "+components[das].getDisplayName()+" Meta: "+components[das].getItemDamage()+", Amount: "+components[das].stackSize); + } + if (M.mBlastFurnaceRequired) { + CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 500); + } + else { + CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 240); + } + } + } + } + } + } + } + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java new file mode 100644 index 0000000000..c0122cbcf5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -0,0 +1,145 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_DustGeneration implements Runnable{ + + final Material toGenerate; + + public RecipeGen_DustGeneration(final Material M){ + this.toGenerate = M; + } + + @Override + public void run() { + generateRecipes(toGenerate); + } + + public static void generateRecipes(final Material material){ + final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 64 : 16; + + Utils.LOG_WARNING("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO + //Ring Recipe + + if (RecipeUtils.addShapedGregtechRecipe( + "craftingToolWrench", null, null, + null, material.getRod(1), null, + null, null, null, + material.getRing(1))){ + Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + final ItemStack normalDust = material.getDust(1); + final ItemStack smallDust = material.getSmallDust(1); + final ItemStack tinyDust = material.getTinyDust(1); + + final ItemStack[] inputStacks = material.getMaterialComposites(); + final ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing); + + if (RecipeUtils.recipeBuilder( + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + normalDust)){ + Utils.LOG_WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } + + if (RecipeUtils.recipeBuilder( + normalDust, null, null, + null, null, null, + null, null, null, + material.getTinyDust(9))){ + Utils.LOG_WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + if (RecipeUtils.recipeBuilder( + smallDust, smallDust, null, + smallDust, smallDust, null, + null, null, null, + normalDust)){ + Utils.LOG_WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + if (RecipeUtils.recipeBuilder( + null, normalDust, null, + null, null, null, + null, null, null, + material.getSmallDust(4))){ + Utils.LOG_WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } + + //Is this a composite? + if (inputStacks != null){ + //Is this a composite? + Utils.LOG_INFO("mixer length: "+inputStacks.length); + if (inputStacks.length != 0 && inputStacks.length <= 4){ + //Log Input items + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); + final long[] inputStackSize = material.vSmallestRatio; + Utils.LOG_INFO("mixer is stacksizeVar null? "+(inputStackSize != null)); + //Is smallest ratio invalid? + if (inputStackSize != null){ + //set stack sizes on an input ItemStack[] + for (short x=0;x<inputStacks.length;x++){ + if (inputStacks[x] != null && inputStackSize[x] != 0) + inputStacks[x].stackSize = (int) inputStackSize[x]; + } + //Relog input values, with stack sizes + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); + + //Get us four ItemStacks to input into the mixer + ItemStack input1, input2, input3, input4; + input1 = (inputStacks.length >= 1) ? (input1 = (inputStacks[0] == null) ? null : inputStacks[0]) : null; + input2 = (inputStacks.length >= 2) ? (input2 = (inputStacks[1] == null) ? null : inputStacks[1]) : null; + input3 = (inputStacks.length >= 3) ? (input3 = (inputStacks[2] == null) ? null : inputStacks[2]) : null; + input4 = (inputStacks.length >= 4) ? (input4 = (inputStacks[3] == null) ? null : inputStacks[3]) : null; + + //Add mixer Recipe + if (GT_Values.RA.addMixerRecipe( + input1, input2, + input3, input4, + null, null, + outputStacks, + (int) Math.max(material.getMass() * 2L * 1, 1), + 6 * material.vVoltageMultiplier)) + { + Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + } + } + + + + + + + } +} + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java new file mode 100644 index 0000000000..f0ebec9c67 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java @@ -0,0 +1,128 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.ItemList; +import gregtech.api.util.GT_Recipe; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_Extruder implements Runnable{ + + final Material toGenerate; + + public RecipeGen_Extruder(final Material M){ + this.toGenerate = M; + } + + @Override + public void run() { + generateRecipes(toGenerate); + } + + public static void generateRecipes(final Material material){ + + final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 64 : 16; + final ItemStack itemIngot = material.getIngot(1); + final ItemStack plate_Single = material.getPlate(1); + final ItemStack itemGear = material.getGear(1); + + final ItemStack shape_Plate = ItemList.Shape_Extruder_Plate.get(0); + final ItemStack shape_Ring = ItemList.Shape_Extruder_Ring.get(0); + final ItemStack shape_Gear = ItemList.Shape_Extruder_Gear.get(0); + final ItemStack shape_Rod = ItemList.Shape_Extruder_Rod.get(0); + final ItemStack shape_Bolt = ItemList.Shape_Extruder_Bolt.get(0); + + Utils.LOG_WARNING("Generating Extruder recipes for "+material.getLocalizedName()); + + + //Plate Recipe + if (addExtruderRecipe( + itemIngot, + shape_Plate, + plate_Single, + 10, 4 * tVoltageMultiplier)){ + Utils.LOG_WARNING("Extruder Plate Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Extruder Plate Recipe: "+material.getLocalizedName()+" - Failed"); + } + + //Ring Recipe + if (!material.isRadioactive){ + if (addExtruderRecipe( + itemIngot, + shape_Ring, + material.getRing(4), + (int) Math.max(material.getMass() * 2L * 1, 1), + 6 * material.vVoltageMultiplier)){ + Utils.LOG_WARNING("Extruder Ring Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Extruder Ring Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + + //Gear Recipe + if (!material.isRadioactive){ + if (addExtruderRecipe( + material.getIngot(8), + shape_Gear, + itemGear, + (int) Math.max(material.getMass() * 5L, 1), + 8 * material.vVoltageMultiplier)){ + Utils.LOG_WARNING("Extruder Gear Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Extruder Gear Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + + //Rod Recipe + if (addExtruderRecipe( + itemIngot, + shape_Rod, + material.getRod(2), + (int) Math.max(material.getMass() * 2L * 1, 1), + 6 * material.vVoltageMultiplier)){ + Utils.LOG_WARNING("Extruder Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Extruder Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + //Bolt Recipe + if (!material.isRadioactive){ + if (addExtruderRecipe( + itemIngot, + shape_Bolt, + material.getBolt(8), + (int) Math.max(material.getMass() * 2L * 1, 1), + 6 * material.vVoltageMultiplier)){ + Utils.LOG_WARNING("Extruder Bolt Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Extruder Bolt Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + } + + + public static boolean addExtruderRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt) { + if ((aInput == null) || (aShape == null) || (aOutput == null)) { + return false; + } + if ((aDuration = GregTech_API.sRecipeFile.get("extruder", aOutput, aDuration)) <= 0) { + return false; + } + GT_Recipe.GT_Recipe_Map.sExtruderRecipes.addRecipe(true, new ItemStack[]{aInput, aShape}, new ItemStack[]{aOutput}, null, null, null, aDuration, aEUt, 0); + return true; + } + + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java new file mode 100644 index 0000000000..0502156525 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java @@ -0,0 +1,130 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.util.GT_Recipe; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_Plates implements Runnable{ + + final Material toGenerate; + + public RecipeGen_Plates(final Material M){ + this.toGenerate = M; + } + + @Override + public void run() { + generateRecipes(toGenerate); + } + + public static void generateRecipes(final Material material){ + + final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 64 : 16; + final ItemStack ingotStackOne = material.getIngot(1); + final ItemStack ingotStackTwo = material.getIngot(2); + final ItemStack shape_Mold = ItemList.Shape_Mold_Plate.get(0); + final ItemStack plate_Single = material.getPlate(1); + final ItemStack plate_SingleTwo = material.getPlate(2); + final ItemStack plate_Double = material.getPlateDouble(1); + + Utils.LOG_WARNING("Generating Plate recipes for "+material.getLocalizedName()); + + //Forge Hammer + if (addForgeHammerRecipe( + ingotStackTwo, + plate_Single, + (int) Math.max(material.getMass(), 1L), + 16)){ + Utils.LOG_WARNING("Forge Hammer Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Forge Hammer Recipe: "+material.getLocalizedName()+" - Failed"); + } + //Bender + if (addBenderRecipe( + ingotStackOne, + plate_Single, + (int) Math.max(material.getMass() * 1L, 1L), + 24)){ + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); + } + //Alloy Smelter + if (GT_Values.RA.addAlloySmelterRecipe( + ingotStackTwo, + shape_Mold, + plate_Single, + (int) Math.max(material.getMass() * 2L, 1L), + 2 * tVoltageMultiplier)){ + Utils.LOG_WARNING("Alloy Smelter Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Alloy Smelter Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + //Making Double Plates + if (addBenderRecipe( + ingotStackTwo, + plate_Double, + (int) Math.max(material.getMass() * 2L, 1L), + 96)){ + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); + } + if (addBenderRecipe( + plate_SingleTwo, + plate_Double, + (int) Math.max(material.getMass() * 2L, 1L), + 96)){ + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + public static boolean addBenderRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt) { + if ((aInput1 == null) || (aOutput1 == null)) { + return false; + } + if ((aDuration = GregTech_API.sRecipeFile.get("bender", aInput1, aDuration)) <= 0) { + return false; + } + new GT_Recipe(aEUt, aDuration, aInput1, aOutput1); + return true; + } + + public static boolean addExtruderRecipe(ItemStack aInput, ItemStack aShape, ItemStack aOutput, int aDuration, int aEUt) { + if ((aInput == null) || (aShape == null) || (aOutput == null)) { + return false; + } + if ((aDuration = GregTech_API.sRecipeFile.get("extruder", aOutput, aDuration)) <= 0) { + return false; + } + GT_Recipe.GT_Recipe_Map.sExtruderRecipes.addRecipe(true, new ItemStack[]{aInput, aShape}, new ItemStack[]{aOutput}, null, null, null, aDuration, aEUt, 0); + return true; + } + + public static boolean addForgeHammerRecipe(ItemStack aInput1, ItemStack aOutput1, int aDuration, int aEUt) { + if ((aInput1 == null) || (aOutput1 == null)) { + return false; + } + if (!GregTech_API.sRecipeFile.get("forgehammer", aOutput1, true)) { + return false; + } + GT_Recipe.GT_Recipe_Map.sHammerRecipes.addRecipe(true, new ItemStack[]{aInput1}, new ItemStack[]{aOutput1}, null, null, null, aDuration, aEUt, 0); + return true; + } + + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java new file mode 100644 index 0000000000..6eaa164342 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java @@ -0,0 +1,196 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.recipe.RecipeUtils; +import net.minecraft.item.ItemStack; + +public class RecipeGen_ShapedCrafting implements Runnable{ + + final Material toGenerate; + + public RecipeGen_ShapedCrafting(final Material M){ + this.toGenerate = M; + } + + @Override + public void run() { + generateRecipes(toGenerate); + } + + public static void generateRecipes(final Material material){ + Utils.LOG_WARNING("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO + + //Plates + + //Single Plate Shaped/Shapeless + GT_ModHandler.addCraftingRecipe( + material.getPlate(1), + gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"h", "B", "I", + Character.valueOf('I'), + material.getIngot(1), + Character.valueOf('B'), + material.getIngot(1)}); + + GT_ModHandler.addShapelessCraftingRecipe( + material.getPlate(1), + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + material.getIngot(1), + material.getIngot(1)}); + + //Double Plate Shaped/Shapeless + GT_ModHandler.addCraftingRecipe( + material.getPlateDouble(1), + gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"I", "B", "h", + Character.valueOf('I'), + material.getPlate(1), + Character.valueOf('B'), + material.getPlate(1)}); + + GT_ModHandler.addShapelessCraftingRecipe( + material.getPlateDouble(1), + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + material.getPlate(1), + material.getPlate(1)}); + + //Ring Recipe + if (!material.isRadioactive){ + if (RecipeUtils.recipeBuilder( + "craftingToolHardHammer", null, null, + null, material.getRod(1), null, + null, null, null, + material.getRing(1))){ + Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + + //Framebox Recipe + if (!material.isRadioactive){ + final ItemStack stackStick = material.getRod(1); + if (RecipeUtils.recipeBuilder( + stackStick, stackStick, stackStick, + stackStick, "craftingToolWrench", stackStick, + stackStick, stackStick, stackStick, + material.getFrameBox(2))){ + Utils.LOG_WARNING("Framebox Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Framebox Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + + //Add a shapeless recipe for each dust this way - Compat mode. + /*ItemStack[] inputStacks = material.getMaterialComposites(); + ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing); + + if (inputStacks.length > 0){ + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); + long[] inputStackSize = material.vSmallestRatio; + if (inputStackSize != null){ + for (short x=0;x<inputStacks.length;x++){ + if (inputStacks[x] != null && inputStackSize[x] != 0) + inputStacks[x].stackSize = (int) inputStackSize[x]; + } + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); + if (RecipeUtils.buildShapelessRecipe( + outputStacks, + inputStacks + )){ + Utils.LOG_WARNING("Shapeless Crafting Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Shapeless Crafting Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + }*/ + + + //Shaped Recipe - Bolts + if (!material.isRadioactive){ + if (RecipeUtils.recipeBuilder( + "craftingToolSaw", null, null, + null, material.getRod(1), null, + null, null, null, + material.getBolt(2))){ + Utils.LOG_WARNING("Bolt Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Bolt Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + + //Shaped Recipe - Ingot to Rod + if (RecipeUtils.recipeBuilder( + "craftingToolFile", null, null, + null, material.getIngot(1), null, + null, null, null, + material.getRod(1))){ + Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + //Shaped Recipe - Long Rod to two smalls + if (RecipeUtils.recipeBuilder( + "craftingToolSaw", null, null, + material.getLongRod(1), null, null, + null, null, null, + material.getRod(2))){ + Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + //Two small to long rod + if (RecipeUtils.recipeBuilder( + material.getRod(1), "craftingToolHardHammer", material.getRod(1), + null, null, null, + null, null, null, + material.getLongRod(1))){ + Utils.LOG_WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + //Rotor Recipe + if (!material.isRadioactive){ + if (RecipeUtils.recipeBuilder( + material.getPlate(1), "craftingToolHardHammer", material.getPlate(1), + material.getScrew(1), material.getRing(1), "craftingToolFile", + material.getPlate(1), "craftingToolScrewdriver", material.getPlate(1), + material.getRotor(1))){ + Utils.LOG_WARNING("Rotor Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Rotor Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + //Screws + if (!material.isRadioactive){ + if (RecipeUtils.recipeBuilder( + "craftingToolFile", material.getBolt(1), null, + material.getBolt(1), null, null, + null, null, null, + material.getScrew(1))){ + Utils.LOG_WARNING("Screw Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_WARNING("Screw Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + } +} |