diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-11-06 19:32:27 +1000 |
commit | cbe0e497be8e466c380a5b4fa781b314ede9ada3 (patch) | |
tree | b85848b432adf458e3abda466ee46d9dfc3e454b /src/Java/gtPlusPlus/xmod/gregtech/loaders | |
parent | c40416b036c0e89451e1558253ccf07bbee028d0 (diff) | |
download | GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.gz GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.bz2 GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.zip |
Revert "$ Cleaned up the entire project."
This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747.
# Conflicts:
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java
# src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java
Revert "% Cleaned up Imports."
This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/loaders')
9 files changed, 709 insertions, 672 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java index cc6f07f494..39b7fb41bd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -1,21 +1,34 @@ package gtPlusPlus.xmod.gregtech.loaders; -import cpw.mods.fml.common.event.FMLInterModComms; -import cpw.mods.fml.common.registry.GameRegistry; 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 gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.registry.GameRegistry; public class Gregtech_Blocks { - // Register default Tile Entity - private static void registerDefailtGtTe() { + public static void run(){ + + //Casing Blocks + ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); + ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2(); + //ModBlocks.blockMetaTileEntity = new GregtechBlockMachines(); + //registerDefailtGtTe(); + + + + + } + + //Register default Tile Entity + private static void registerDefailtGtTe(){ Utils.LOG_INFO("Registering new GT TileEntities."); - final BaseMetaTileEntity tBaseMetaTileEntity = Meta_GT_Proxy.constructBaseMetaTileEntity(); + BaseMetaTileEntity tBaseMetaTileEntity = Meta_GT_Proxy.constructBaseMetaTileEntity(); Utils.LOG_INFO("Testing BaseMetaTileEntity."); if (tBaseMetaTileEntity == null) { @@ -24,18 +37,7 @@ public class Gregtech_Blocks { } Utils.LOG_INFO("Registering the BaseMetaTileEntityEx."); GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntityEx"); - FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial", - tBaseMetaTileEntity.getClass().getName()); - } - - public static void run() { - - // Casing Blocks - ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); - ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2(); - // ModBlocks.blockMetaTileEntity = new GregtechBlockMachines(); - // registerDefailtGtTe(); - + 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 076188e33b..b34aead51e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingToolHeadChoocher.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.loaders; -import gregtech.api.enums.*; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.ToolDictNames; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.util.Utils; @@ -12,94 +15,78 @@ import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import net.minecraft.item.ItemStack; public class ProcessingToolHeadChoocher implements Interface_OreRecipeRegistrator, Runnable { - public ProcessingToolHeadChoocher() { - GregtechOrePrefixes.toolSkookumChoocher.add(this); - } - - public void materialsLoops() { - final Materials[] i = Materials.values(); - final int size = i.length; - Utils.LOG_WARNING("Materials to attempt tool gen. with: " + size); - int used = 0; - Materials aMaterial = null; - for (int r = 0; r < size; r++) { - aMaterial = i[r]; - if (aMaterial != Materials.Stone && aMaterial != Materials.Flint && aMaterial != Materials.Rubber - && aMaterial != Materials._NULL) { - if (!aMaterial.contains(SubTag.WOOD) && !aMaterial.contains(SubTag.BOUNCY) - && !aMaterial.contains(SubTag.NO_SMASHING) && !aMaterial.contains(SubTag.TRANSPARENT) - && !aMaterial.contains(SubTag.FLAMMABLE) && !aMaterial.contains(SubTag.MAGICAL) - && !aMaterial.contains(SubTag.NO_SMELTING)) { - Utils.LOG_WARNING("Found " + aMaterial.name() + " as a valid Skookum Choocher Material."); - // Input 1 - final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); - final ItemStack ingot = GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L); - final ItemStack screw = GT_OreDictUnificator.get(OrePrefixes.screw, aMaterial, 1L); - final ItemStack longrod = GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L); - final ItemStack hammerhead = GT_OreDictUnificator.get(OrePrefixes.toolHeadHammer, aMaterial, 1L); - - if (null != plate && null != ingot && null != hammerhead && null != longrod && null != screw) { - RecipeUtils.recipeBuilder(hammerhead, ToolDictNames.craftingToolScrewdriver.name(), plate, - ingot, plate, plate, longrod, screw, null, - MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( - MetaGeneratedGregtechTools.SKOOKUM_CHOOCHER, 1, aMaterial, null, null)); - used++; - } - else { - Utils.LOG_WARNING("" + aMaterial.name() + " could not be used for all input compoenents. [3x" - + aMaterial.name() + " plates, 2x" + aMaterial.name() + " ingots, 1x" + aMaterial.name() - + " Hard Hammer Head."); - } - // GT_ModHandler.addCraftingRecipe(, - // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | - // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", - // "PIP", " I ", Character.valueOf('I'), - // OrePrefixes.ingot.get(aMaterial), Character.valueOf('P'), - // OrePrefixes.plate.get(aMaterial), Character.valueOf('H'), - // OrePrefixes.toolHeadHammer.get(aMaterial)}); - } - else { - Utils.LOG_WARNING("" + aMaterial.name() + " was not a valid Skookum Choocher Material."); - } - } - else { - Utils.LOG_WARNING("" + aMaterial.name() + " was not a valid Skookum Choocher Material."); - } + public ProcessingToolHeadChoocher() { + GregtechOrePrefixes.toolSkookumChoocher.add(this); + } - } - - Utils.LOG_INFO("Materials used for tool gen: " + used); - } + @Override + public void registerOre(GregtechOrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe(MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"IhI", "III", " I ", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial)}); + } + } + } @Override - public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { + public void registerOre(GregtechOrePrefixes aPrefix, + GT_Materials aMaterial, String aOreDictName, String aModName, + ItemStack aStack) { // TODO Auto-generated method stub - + } - - @Override - public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, - final String aModName, final ItemStack aStack) { - if (aMaterial != Materials.Stone && aMaterial != Materials.Flint) { - if (aMaterial != Materials.Rubber) { - if (!aMaterial.contains(SubTag.WOOD) && !aMaterial.contains(SubTag.BOUNCY) - && !aMaterial.contains(SubTag.NO_SMASHING)) { - GT_ModHandler.addCraftingRecipe( - MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), - GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { - "IhI", "III", " I ", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial) - }); + + public void materialsLoops(){ + Materials[] i = Materials.values(); + int size = i.length; + Utils.LOG_WARNING("Materials to attempt tool gen. with: "+size); + int used = 0; + Materials aMaterial = null; + for (int r=0;r<size;r++){ + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) && (!aMaterial.contains(SubTag.NO_SMASHING))&& (!aMaterial.contains(SubTag.TRANSPARENT))&& (!aMaterial.contains(SubTag.FLAMMABLE))&& (!aMaterial.contains(SubTag.MAGICAL))&& (!aMaterial.contains(SubTag.NO_SMELTING))) { + Utils.LOG_WARNING("Found "+aMaterial.name()+" as a valid Skookum Choocher Material."); + //Input 1 + ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + ItemStack ingot = GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L); + ItemStack screw = GT_OreDictUnificator.get(OrePrefixes.screw, aMaterial, 1L); + ItemStack longrod = GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L); + ItemStack hammerhead = GT_OreDictUnificator.get(OrePrefixes.toolHeadHammer, aMaterial, 1L); + + if (null != plate && null != ingot && null != hammerhead && null != longrod && null != screw){ + RecipeUtils.recipeBuilder( + hammerhead, ToolDictNames.craftingToolScrewdriver.name(), plate, + ingot, plate, plate, + longrod, screw, null, + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(MetaGeneratedGregtechTools.SKOOKUM_CHOOCHER, 1, aMaterial, null, null)); + used++; + } + else { + Utils.LOG_WARNING(""+aMaterial.name()+" could not be used for all input compoenents. [3x"+aMaterial.name()+" plates, 2x"+aMaterial.name()+" ingots, 1x"+aMaterial.name()+" Hard Hammer Head."); + } + //GT_ModHandler.addCraftingRecipe(, GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } + else { + Utils.LOG_WARNING(""+aMaterial.name()+" was not a valid Skookum Choocher Material."); } + } + else { + Utils.LOG_WARNING(""+aMaterial.name()+" was not a valid Skookum Choocher Material."); } + + } + + Utils.LOG_INFO("Materials used for tool gen: "+used); } @Override public void run() { Utils.LOG_INFO("Generating Skookum Choochers of all GT Materials."); - this.materialsLoops(); + materialsLoops(); } - + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java index 783370f612..41e0511ace 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Processing_Textures_Items.java @@ -3,7 +3,8 @@ package gtPlusPlus.xmod.gregtech.loaders; import gtPlusPlus.xmod.gregtech.api.enums.GregtechTextures.ItemIcons.CustomIcon; public class Processing_Textures_Items { - + public static final CustomIcon itemSkookumChoocher = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); - + } + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index a7965327fe..42f3829045 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.loaders; -import java.util.ArrayList; - import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gtPlusPlus.core.lib.CORE; @@ -9,97 +7,97 @@ 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 { +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) { + public static void generateARecipe(final Material M){ - // Add a Blast Smelting Recipe, Let's go! + //Add a Blast Smelting Recipe, Let's go! ItemStack tStack; if (null != (tStack = M.getDust(1))) { - // Prepare some Variables + //Prepare some Variables ItemStack[] components; ArrayList<MaterialStack> tMaterial = new ArrayList<MaterialStack>(); - short counter = 0; - int inputStackCount = 0; - int fluidAmount = 0; - final boolean doTest = true; - tMaterial = M.getComposites(); + 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? + //This Bad boy here is what dictates unique recipes. Fuck life, right? ItemStack circuitGT = ItemUtils.getGregtechCircuit(0); - // Set a duration + + //Set a duration int duration = 0; - if (M.getMeltingPointK() > 150) { + if (M.getMeltingPointK() > 150){ duration = (int) Math.max(M.getMass() / 50L, 1L) * M.getMeltingPointK(); } else { - duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; + duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; } - int mMaterialListSize = 0; - if (M.getComposites() != null) { - for (final gtPlusPlus.core.material.MaterialStack ternkfsdf : M.getComposites()) { - if (ternkfsdf != null) { - mMaterialListSize++; - } + + int mMaterialListSize=0; + if (M.getComposites() != null){ + for (gtPlusPlus.core.material.MaterialStack ternkfsdf : M.getComposites()){ + if (ternkfsdf != null) + mMaterialListSize++; } } else { - mMaterialListSize = 1; - } + mMaterialListSize = 1; + } + + Utils.LOG_WARNING("Size: "+mMaterialListSize); - Utils.LOG_WARNING("Size: " + mMaterialListSize); - // Make a simple one Material Materialstack[] and log it for - // validity. + //Make a simple one Material Materialstack[] and log it for validity. circuitGT = ItemUtils.getGregtechCircuit(1); - final ItemStack[] tItemStackTest = new ItemStack[] { - circuitGT, tStack - }; + 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); - } + 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); - final boolean hasMoreInputThanACircuit = tItemStackTest.length > 1; - - // Generate Recipes for all singular materials that can be made - // molten. - if (hasMoreInputThanACircuit) { + //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)) { + 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)) { + 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)) { + 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)) { + 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)) { + 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)) { + 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."); } } @@ -110,117 +108,103 @@ public class RecipeGen_BlastSmelter implements Runnable { } } else { - if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration / 2, 120)) { + 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)) { + 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)) { + 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."); } - final 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)) { + 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)) { + } + 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)) { + 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 (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) { - final 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 (final 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; - } + + //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 + //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) { - final int r = (int) M.vSmallestRatio[irc]; - inputStackCount = inputStackCount + r; + 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) { - final 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) { + + //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]; - } + components[fr] = components_NoCircuit[fr-1]; + } } - Utils.LOG_INFO("Should have added a circuit. mMaterialListSize: " + mMaterialListSize - + " | circuit: " + components[0].getDisplayName()); + 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); + Utils.LOG_INFO("Did not add a circuit. mMaterialListSize: "+mMaterialListSize); } - // Set Fluid output - fluidAmount = 144 * inputStackCount; + //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); - } + 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 + //Adds Recipe if (M.requiresBlastFurnace()) { - if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, - 500)) { + if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, 500)){ Utils.LOG_WARNING("Success."); } else { @@ -228,31 +212,19 @@ public class RecipeGen_BlastSmelter implements Runnable { } } else { - if (CORE.RA.addBlastSmelterRecipe(components, M.getFluid(fluidAmount), 100, duration, - 240)) { + 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)); + Utils.LOG_WARNING("doTest: "+doTest+" | tMaterial != null: "+(tMaterial != null)); } } } - - final Material toGenerate; - - public RecipeGen_BlastSmelter(final Material M) { - this.toGenerate = M; - } - - @Override - public void run() { - RecipeGen_BlastSmelter.generateARecipe(this.toGenerate); - } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java index 8044c78a39..be2dbff77a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT.java @@ -1,6 +1,8 @@ package gtPlusPlus.xmod.gregtech.loaders; -import gregtech.api.enums.*; +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; @@ -8,173 +10,157 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; -public class RecipeGen_BlastSmelterGT implements Runnable { +public class RecipeGen_BlastSmelterGT implements Runnable{ + + public RecipeGen_BlastSmelterGT(){ + + } + + @Override + public void run() { + generateRecipes(); + } - public static void generateRecipes() { + public static void generateRecipes(){ - final Materials[] GregMaterials = Materials.values(); + Materials[] GregMaterials = Materials.values(); - for (final Materials M : GregMaterials) { + 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! + || !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)) { + if ((null != (tStack = GT_OreDictUnificator.get(OrePrefixes.ingot, M.mSmeltInto, 1L))) && (!M.contains(SubTag.NO_SMELTING) && (M.contains(SubTag.METAL)))) { - // Prepare some Variables + //Prepare some Variables ItemStack[] components; MaterialStack[] tMaterial; - short counter = 0; - int inputStackCount = 0; - int fluidAmount = 0; + short counter=0; + int inputStackCount=0; + int fluidAmount=0; boolean doTest = true; - // This Bad boy here is what dictates unique recipes. Fuck - // life, right? + //This Bad boy here is what dictates unique recipes. Fuck life, right? ItemStack circuitGT = ItemUtils.getGregtechCircuit(0); - // Set a duration + + //Set a duration int duration = 0; - if (M.mBlastFurnaceTemp > 150) { + if (M.mBlastFurnaceTemp > 150){ duration = (int) Math.max(M.getMass() / 50L, 1L) * M.mBlastFurnaceTemp; } else { - duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; + 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) - }; + + //Make a simple one Material Materialstack[] and log it for validity. + tMaterial = new MaterialStack[]{new MaterialStack(M, 1)}; circuitGT = ItemUtils.getGregtechCircuit(1); - final ItemStack[] tItemStackTest = new ItemStack[] { - circuitGT, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust" + M, 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); - } + 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. + //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); + doTest = CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getMolten(fluidAmount), 100, duration, 240); } else { - doTest = CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getMolten(fluidAmount), 100, - duration / 2, 120); + 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; + if (doTest){ + //Reset the Variables for compounds if last recipe was a success. + inputStackCount=0; + counter=0; + - int mMaterialListSize = 0; - for (final MaterialStack ternkfsdf : M.mMaterialList) { + 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) { - final MaterialStack[] tempStack = new MaterialStack[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 (final MaterialStack xMaterial : M.mMaterialList) { - Utils.LOG_WARNING("FOUND: " + xMaterial.mMaterial); - Utils.LOG_WARNING("ADDING: " + xMaterial.mMaterial); + //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 + //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 (final MaterialStack aOutputPart : tempStack) { - if (aOutputPart != null) { - Utils.LOG_WARNING("Finding dust: " + aOutputPart.mMaterial); - final ItemStack rStack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken( - "dust" + aOutputPart.mMaterial, (int) aOutputPart.mAmount); - if (rStack != null) { - Utils.LOG_WARNING("Found dust: " + aOutputPart.mMaterial); + 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; + inputStackCount = inputStackCount+rStack.stackSize; } - } - counter++; + } + counter++; } - if (mMaterialListSize > 0 && mMaterialListSize < 9) { - final 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) { + + 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]; - } + 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); - } + /*//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); + CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 500); } else { - CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, - 240); + CORE.RA.addBlastSmelterRecipe(components, M.getMolten(fluidAmount), 100, duration, 240); } } } @@ -183,13 +169,4 @@ public class RecipeGen_BlastSmelterGT implements Runnable { } } } - - public RecipeGen_BlastSmelterGT() { - - } - - @Override - public void run() { - RecipeGen_BlastSmelterGT.generateRecipes(); - } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index 01512a0abc..c0122cbcf5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -7,22 +7,37 @@ import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; -public class RecipeGen_DustGeneration implements Runnable { +public class RecipeGen_DustGeneration implements Runnable{ - public static void generateRecipes(final Material material) { + 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 + 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"); + 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"); + 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); @@ -30,87 +45,101 @@ public class RecipeGen_DustGeneration implements Runnable { 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"); + 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"); + 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"); + 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"); + 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"); + + 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"); + 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"); + + 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"); + 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 + //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) { + 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 + //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"); + 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"); + Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); } } } } + + + + + } - - final Material toGenerate; - - public RecipeGen_DustGeneration(final Material M) { - this.toGenerate = M; - } - - @Override - public void run() { - RecipeGen_DustGeneration.generateRecipes(this.toGenerate); - } } + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java index 626dbbe004..f0ebec9c67 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java @@ -7,25 +7,20 @@ import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import net.minecraft.item.ItemStack; -public class RecipeGen_Extruder implements Runnable { +public class RecipeGen_Extruder implements Runnable{ - public static boolean addExtruderRecipe(final ItemStack aInput, final ItemStack aShape, final ItemStack aOutput, - int aDuration, final 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; + 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) { + public static void generateRecipes(final Material material){ final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 64 : 16; final ItemStack itemIngot = material.getIngot(1); @@ -38,69 +33,96 @@ public class RecipeGen_Extruder implements Runnable { 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()); + Utils.LOG_WARNING("Generating Extruder recipes for "+material.getLocalizedName()); - // Plate Recipe - if (RecipeGen_Extruder.addExtruderRecipe(itemIngot, shape_Plate, plate_Single, 10, 4 * tVoltageMultiplier)) { - Utils.LOG_WARNING("Extruder Plate Recipe: " + material.getLocalizedName() + " - Success"); + + //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"); + Utils.LOG_WARNING("Extruder Plate Recipe: "+material.getLocalizedName()+" - Failed"); } - // Ring Recipe - if (!material.isRadioactive) { - if (RecipeGen_Extruder.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"); + //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"); + Utils.LOG_WARNING("Extruder Ring Recipe: "+material.getLocalizedName()+" - Failed"); } } - // Gear Recipe - if (!material.isRadioactive) { - if (RecipeGen_Extruder.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"); + + //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"); + Utils.LOG_WARNING("Extruder Gear Recipe: "+material.getLocalizedName()+" - Failed"); } } - // Rod Recipe - if (RecipeGen_Extruder.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"); + + //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"); + Utils.LOG_WARNING("Extruder Rod Recipe: "+material.getLocalizedName()+" - Failed"); } - // Bolt Recipe - if (!material.isRadioactive) { - if (RecipeGen_Extruder.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"); + + //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"); + Utils.LOG_WARNING("Extruder Bolt Recipe: "+material.getLocalizedName()+" - Failed"); } } - } + } - final Material toGenerate; - public RecipeGen_Extruder(final Material M) { - this.toGenerate = M; + 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; } - @Override - public void run() { - RecipeGen_Extruder.generateRecipes(this.toGenerate); - } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java index 96d7fdd5f2..0502156525 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java @@ -8,53 +8,20 @@ import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import net.minecraft.item.ItemStack; -public class RecipeGen_Plates implements Runnable { +public class RecipeGen_Plates implements Runnable{ - public static boolean addBenderRecipe(final ItemStack aInput1, final ItemStack aOutput1, int aDuration, - final 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(final ItemStack aInput, final ItemStack aShape, final ItemStack aOutput, - int aDuration, final 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; + final Material toGenerate; + + public RecipeGen_Plates(final Material M){ + this.toGenerate = M; } - - public static boolean addForgeHammerRecipe(final ItemStack aInput1, final ItemStack aOutput1, final int aDuration, - final 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; + + @Override + public void run() { + generateRecipes(toGenerate); } - - public static void generateRecipes(final Material material) { + + public static void generateRecipes(final Material material){ final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 64 : 16; final ItemStack ingotStackOne = material.getIngot(1); @@ -64,59 +31,100 @@ public class RecipeGen_Plates implements Runnable { 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 (RecipeGen_Plates.addForgeHammerRecipe(ingotStackTwo, plate_Single, (int) Math.max(material.getMass(), 1L), - 16)) { - Utils.LOG_WARNING("Forge Hammer Recipe: " + material.getLocalizedName() + " - Success"); + 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"); + Utils.LOG_WARNING("Forge Hammer Recipe: "+material.getLocalizedName()+" - Failed"); } - // Bender - if (RecipeGen_Plates.addBenderRecipe(ingotStackOne, plate_Single, (int) Math.max(material.getMass() * 1L, 1L), - 24)) { - Utils.LOG_WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); + //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"); + 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"); + //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"); + Utils.LOG_WARNING("Alloy Smelter Recipe: "+material.getLocalizedName()+" - Failed"); } - // Making Double Plates - if (RecipeGen_Plates.addBenderRecipe(ingotStackTwo, plate_Double, (int) Math.max(material.getMass() * 2L, 1L), - 96)) { - Utils.LOG_WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); + + //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"); + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); } - if (RecipeGen_Plates.addBenderRecipe(plate_SingleTwo, plate_Double, (int) Math.max(material.getMass() * 2L, 1L), - 96)) { - Utils.LOG_WARNING("Bender Recipe: " + material.getLocalizedName() + " - Success"); + 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"); - } + Utils.LOG_WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); + } } - final Material toGenerate; + 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 RecipeGen_Plates(final Material M) { - this.toGenerate = M; + 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; } - @Override - public void run() { - RecipeGen_Plates.generateRecipes(this.toGenerate); + 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 index 1667f8abe3..6eaa164342 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java @@ -6,152 +6,191 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; -public class RecipeGen_ShapedCrafting implements Runnable { - - 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"); +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"); + Utils.LOG_WARNING("Ring Recipe: "+material.getLocalizedName()+" - Failed"); } } - // Framebox Recipe - if (!material.isRadioactive) { + + //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"); + 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"); + 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"); + + //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"); + 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"); + + //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"); + 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"); + + //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"); + 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"); + //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"); + 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"); + //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"); + 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"); + //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"); + Utils.LOG_WARNING("Screw Recipe: "+material.getLocalizedName()+" - Failed"); } } } - - final Material toGenerate; - - public RecipeGen_ShapedCrafting(final Material M) { - this.toGenerate = M; - } - - @Override - public void run() { - RecipeGen_ShapedCrafting.generateRecipes(this.toGenerate); - } } |