diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-23 16:39:30 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-23 16:39:30 +1000 |
commit | 6754387bca14ef3c2bdc5e69d0f4920ca7568553 (patch) | |
tree | b6bd67e213a66bce0e418105b8a7ac51a141b6a0 /src | |
parent | 3826cbb1223a25a6d476486d9369d65a22090aec (diff) | |
download | GT5-Unofficial-6754387bca14ef3c2bdc5e69d0f4920ca7568553.tar.gz GT5-Unofficial-6754387bca14ef3c2bdc5e69d0f4920ca7568553.tar.bz2 GT5-Unofficial-6754387bca14ef3c2bdc5e69d0f4920ca7568553.zip |
% Moved more recipe generation to separate classes, now the order of item generation isn't important because recipe generation now happens after, not during item creation.
% Most Generated Item classes are now < 10 lines.
> This should slightly improve the startup time by 10-15 seconds, maybe more, maybe less.
Diffstat (limited to 'src')
15 files changed, 316 insertions, 208 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 46a39a5883..02f8f63175 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -34,7 +34,7 @@ public class BaseItemComponent extends Item{ this.setMaxStackSize(64); this.setTextureName(CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME); GameRegistry.registerItem(this, unlocalName); - GT_OreDictUnificator.registerOre(componentType.COMPONENT_NAME.toLowerCase()+material.getUnlocalizedName(), UtilsItems.getSimpleStack(this)); + GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), UtilsItems.getSimpleStack(this)); } @Override @@ -118,23 +118,25 @@ public class BaseItemComponent extends Item{ public static enum ComponentTypes { - DUST("Dust", " Dust"), - INGOT("Ingot", " Ingot"), - PLATE("Plate", " Plate"), - PLATEDOUBLE("PlateDouble", " Double Plate"), - ROD("Rod", " Rod"), - RODLONG("RodLong", " Long Rod"), - GEAR("Gear", " Gear"), - SCREW("Screw", " Screw"), - BOLT("Bolt", " Bolt"), - ROTOR("Rotor", " Rotor"), - RING("Ring", " Ring"); + DUST("Dust", " Dust", "dust"), + INGOT("Ingot", " Ingot", "ingot"), + PLATE("Plate", " Plate", "plate"), + PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble"), + ROD("Rod", " Rod", "stick"), + RODLONG("RodLong", " Long Rod", "stickLong"), + GEAR("Gear", " Gear", "gear"), + SCREW("Screw", " Screw", "screw"), + BOLT("Bolt", " Bolt", "bolt"), + ROTOR("Rotor", " Rotor", "rotor"), + RING("Ring", " Ring", "ring"); private String COMPONENT_NAME; private String DISPLAY_NAME; - private ComponentTypes (final String LocalName, String DisplayName){ + private String OREDICT_NAME; + private ComponentTypes (final String LocalName, String DisplayName, String OreDictName){ this.COMPONENT_NAME = LocalName; this.DISPLAY_NAME = DisplayName; + this.OREDICT_NAME = OreDictName; } public String getComponent(){ @@ -144,6 +146,11 @@ public class BaseItemComponent extends Item{ public String getName(){ return DISPLAY_NAME; } + + public String getOreDictName(){ + return OREDICT_NAME; + } + } } diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java index 0bd42e6eac..6292c5cde6 100644 --- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java +++ b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java @@ -1,32 +1,11 @@ package gtPlusPlus.core.item.base.bolts; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import net.minecraft.item.ItemStack; public class BaseItemBolt extends BaseItemComponent{ public BaseItemBolt(Material material) { super(material, BaseItemComponent.ComponentTypes.BOLT); - - addExtruderRecipe(); } - - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Bolts"); - String tempIngot = unlocalName.replace("itemBolt", "ingot"); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ - GT_Values.RA.addExtruderRecipe(tempOutputStack, - ItemList.Shape_Extruder_Bolt.get(0), - UtilsItems.getSimpleStack(this, 8), - (int) Math.max(componentMaterial.getMass() * 2L * 1, 1), - 8 * componentMaterial.vVoltageMultiplier); - } - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java index 56784e8530..7c4fe89568 100644 --- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java +++ b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java @@ -1,31 +1,11 @@ package gtPlusPlus.core.item.base.gears; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import net.minecraft.item.ItemStack; public class BaseItemGear extends BaseItemComponent{ public BaseItemGear(Material material) { super(material, BaseItemComponent.ComponentTypes.GEAR); - addExtruderRecipe(); } - - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Gears"); - ItemStack tempOutputStack = componentMaterial.getIngot(8); - if (null != tempOutputStack){ - GT_Values.RA.addExtruderRecipe( - tempOutputStack, - ItemList.Shape_Extruder_Gear.get(0), - UtilsItems.getSimpleStack(this), - (int) Math.max(componentMaterial.getMass() * 5L, 1), - 8 * componentMaterial.vVoltageMultiplier); - } - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java index fd09276dc3..6ad3509876 100644 --- a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java +++ b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java @@ -1,45 +1,11 @@ package gtPlusPlus.core.item.base.rings; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; -import net.minecraft.item.ItemStack; public class BaseItemRing extends BaseItemComponent{ public BaseItemRing(Material material) { super(material, BaseItemComponent.ComponentTypes.RING); - addExtruderRecipe(); } - - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Rings"); - - //Extruder Recipe - String tempIngot = unlocalName.replace("itemRing", "ingot"); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ - GT_Values.RA.addExtruderRecipe(tempOutputStack, - ItemList.Shape_Extruder_Ring.get(0), - UtilsItems.getSimpleStack(this, 4), - (int) Math.max(componentMaterial.getMass() * 2L * 1, 1), - 6 * componentMaterial.vVoltageMultiplier); - } - - //Shaped Recipe - tempIngot = unlocalName.replace("itemRing", "stick"); - tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ - UtilsRecipe.addShapedGregtechRecipe( - "craftingToolWrench", null, null, - null, tempOutputStack, null, - null, null, null, - UtilsItems.getSimpleStack(this, 1)); - } - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java index 6f7cf4b6bc..2e4acd6ccb 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java @@ -1,43 +1,24 @@ package gtPlusPlus.core.item.base.rods; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; import net.minecraft.item.ItemStack; public class BaseItemRod extends BaseItemComponent{ public BaseItemRod(Material material) { super(material, BaseItemComponent.ComponentTypes.ROD); - - if (!material.equals(ELEMENT.URANIUM233)){ - addExtruderRecipe(); - } - + addExtruderRecipe(); } private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Rods"); + Utils.LOG_WARNING("Adding cutter recipe for "+materialName+" Rods"); ItemStack stackStick = componentMaterial.getRod(1); - ItemStack stackStick2 = componentMaterial.getRod(2); ItemStack stackBolt = componentMaterial.getBolt(4); - ItemStack stackStickLong = componentMaterial.getLongRod(1); - ItemStack stackIngot = componentMaterial.getIngot(1); - - - GT_Values.RA.addExtruderRecipe( - stackIngot, - ItemList.Shape_Extruder_Rod.get(0), - stackStick2, - (int) Math.max(componentMaterial.getMass() * 2L * 1, 1), - 6 * componentMaterial.vVoltageMultiplier); GT_Values.RA.addCutterRecipe( stackStick, @@ -45,34 +26,6 @@ public class BaseItemRod extends BaseItemComponent{ null, (int) Math.max(componentMaterial.getMass() * 2L, 1L), 4); - - if (componentMaterial.isRadioactive){ - UtilsRecipe.recipeBuilder( - stackStick, stackStick, stackStick, - stackStick, "craftingToolWrench", stackStick, - stackStick, stackStick, stackStick, - UtilsItems.getItemStackOfAmountFromOreDict(unlocalName.replace("itemRod", "frameGt"), 2)); - } - - //Shaped Recipe - Bolts - stackBolt = componentMaterial.getBolt(2); - if (null != stackBolt){ - UtilsRecipe.recipeBuilder( - "craftingToolSaw", null, null, - null, stackStick, null, - null, null, null, - stackBolt); - } - - //Shaped Recipe - Ingot to Rod - if (null != stackIngot){ - UtilsRecipe.recipeBuilder( - "craftingToolFile", null, null, - null, stackIngot, null, - null, null, null, - stackStick); - } - } } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java index 714f8dc145..4c1d36f945 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java @@ -5,7 +5,6 @@ import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; import net.minecraft.item.ItemStack; public class BaseItemRodLong extends BaseItemComponent{ @@ -28,12 +27,6 @@ public class BaseItemRodLong extends BaseItemComponent{ ItemStack stackStick = UtilsItems.getItemStackOfAmountFromOreDict(tempStick, 1); ItemStack stackLong = UtilsItems.getItemStackOfAmountFromOreDict(tempStickLong, 1); - UtilsRecipe.addShapedGregtechRecipe( - stackStick, "craftingToolHardHammer", stackStick, - null, null, null, - null, null, null, - stackLong); - ItemStack temp = stackStick; temp.stackSize = 2; @@ -48,17 +41,7 @@ public class BaseItemRodLong extends BaseItemComponent{ temp, null, (int) Math.max(componentMaterial.getMass(), 1L), - 4); - - //Shaped Recipe - Long Rod to two smalls - if (null != stackLong){ - stackStick.stackSize = 2; - UtilsRecipe.recipeBuilder( - "craftingToolSaw", null, null, - stackLong, null, null, - null, null, null, - stackStick); - } + 4); } } diff --git a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java index dd4804125a..f993cc64b2 100644 --- a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java +++ b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java @@ -2,28 +2,10 @@ package gtPlusPlus.core.item.base.rotors; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; -import net.minecraft.item.ItemStack; public class BaseItemRotor extends BaseItemComponent{ public BaseItemRotor(Material material) { super(material, BaseItemComponent.ComponentTypes.ROTOR); - generateRecipe(); } - - public void generateRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Rotors"); - ItemStack tempOutputStack = this.componentMaterial.getPlate(1); - ItemStack screwStack = this.componentMaterial.getScrew(1); - ItemStack ringStack = this.componentMaterial.getRing(1); - UtilsRecipe.addShapedGregtechRecipe( - tempOutputStack, "craftingToolHardHammer", tempOutputStack, - screwStack, ringStack, "craftingToolFile", - tempOutputStack, "craftingToolScrewdriver", tempOutputStack, - UtilsItems.getSimpleStack(this)); - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java index 84ac759ba8..212dcd0fc1 100644 --- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java +++ b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java @@ -5,7 +5,6 @@ import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; import net.minecraft.item.ItemStack; public class BaseItemScrew extends BaseItemComponent{ @@ -24,14 +23,7 @@ public class BaseItemScrew extends BaseItemComponent{ UtilsItems.getSimpleStack(this), null, (int) Math.max(componentMaterial.getMass() / 8L, 1L), - 4); - - - UtilsRecipe.recipeBuilder( - "craftingToolFile", boltStack, null, - boltStack, null, null, - null, null, null, - UtilsItems.getSimpleStack(this)); + 4); } } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index d6f5d77f20..27a9f53ced 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -184,15 +184,15 @@ public class Material { } public ItemStack getDust(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("dust"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+unlocalizedName, stacksize); } public ItemStack getSmallDust(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("dustSmall"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+unlocalizedName, stacksize); } public ItemStack getTinyDust(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("dustTiny"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+unlocalizedName, stacksize); } public ItemStack[] getValidInputStacks(){ @@ -200,43 +200,47 @@ public class Material { } public ItemStack getIngot(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("ingot"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("ingot"+unlocalizedName, stacksize); } public ItemStack getPlate(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("plate"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("plate"+unlocalizedName, stacksize); } public ItemStack getPlateDouble(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("plateDouble"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("plateDouble"+unlocalizedName, stacksize); } public ItemStack getGear(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("gear"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("gear"+unlocalizedName, stacksize); } public ItemStack getRod(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("stick"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("stick"+unlocalizedName, stacksize); } public ItemStack getLongRod(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("stickLong"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("stickLong"+unlocalizedName, stacksize); } public ItemStack getBolt(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("bolt"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("bolt"+unlocalizedName, stacksize); } public ItemStack getScrew(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("screw"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("screw"+unlocalizedName, stacksize); } public ItemStack getRing(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("ring"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("ring"+unlocalizedName, stacksize); } public ItemStack getRotor(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDict("rotor"+unlocalizedName, stacksize); + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("rotor"+unlocalizedName, stacksize); + } + + public ItemStack getFrameBox(int stacksize){ + return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("frameGt"+unlocalizedName, stacksize); } public ItemStack[] getMaterialComposites(){ diff --git a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java index fbda7554df..530ac24f98 100644 --- a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java +++ b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java @@ -32,7 +32,9 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.wrapper.var; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Extruder; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting; import java.util.ArrayList; import java.util.List; @@ -380,7 +382,10 @@ public class UtilsItems { temp = new BaseItemGear(matInfo); } + //Add A jillion Recipes RecipeGen_Plates.generateRecipes(matInfo); + RecipeGen_Extruder.generateRecipes(matInfo); + RecipeGen_ShapedCrafting.generateRecipes(matInfo); FluidUtils.generateFluid(matInfo, 1); diff --git a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java b/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java index 727e40f570..624bde2ead 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java +++ b/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java @@ -314,7 +314,7 @@ public class UtilsRecipe { - public static void addShapedGregtechRecipe( + public static boolean addShapedGregtechRecipe( Object InputItem1, Object InputItem2, Object InputItem3, Object InputItem4, Object InputItem5, Object InputItem6, Object InputItem7, Object InputItem8, Object InputItem9, @@ -330,7 +330,7 @@ public class UtilsRecipe { (!(InputItem8 instanceof ItemStack) && !(InputItem8 instanceof String) && (InputItem8 != null)) || (!(InputItem9 instanceof ItemStack) && !(InputItem9 instanceof String) && (InputItem9 != null))){ Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String."); - return; + return false; } if (GT_ModHandler.addCraftingRecipe(OutputItem, @@ -348,7 +348,9 @@ public class UtilsRecipe { 'I', InputItem9})){ Utils.LOG_INFO("Success! Added a recipe for "+OutputItem.getDisplayName()); RegistrationHandler.recipesSuccess++; + return true; } + return false; } public static void addShapelessGregtechRecipe(ItemStack OutputItem, Object... inputItems){ 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..0f9a1bca7f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java @@ -0,0 +1,117 @@ +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 { + + public static void generateRecipes(Material material){ + + int tVoltageMultiplier = material.getMeltingPoint_K() >= 2800 ? 64 : 16; + ItemStack itemIngot = material.getIngot(1); + ItemStack plate_Single = material.getPlate(1); + ItemStack itemGear = material.getGear(1); + + ItemStack shape_Plate = ItemList.Shape_Extruder_Plate.get(0); + ItemStack shape_Ring = ItemList.Shape_Extruder_Ring.get(0); + ItemStack shape_Gear = ItemList.Shape_Extruder_Gear.get(0); + ItemStack shape_Rod = ItemList.Shape_Extruder_Rod.get(0); + ItemStack shape_Bolt = ItemList.Shape_Extruder_Bolt.get(0); + + Utils.LOG_INFO("Generating Extruder recipes for "+material.getLocalizedName()); + + + //Plate Recipe + if (addExtruderRecipe( + itemIngot, + shape_Plate, + plate_Single, + 10, 4 * tVoltageMultiplier)){ + Utils.LOG_INFO("Extruder Plate Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("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_INFO("Extruder Ring Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("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_INFO("Extruder Gear Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("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_INFO("Extruder Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("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), + 8 * material.vVoltageMultiplier)){ + Utils.LOG_INFO("Extruder Bolt Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("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 index 627cba7064..40895b8c86 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java @@ -46,17 +46,6 @@ public class RecipeGen_Plates { else { Utils.LOG_INFO("Bender Recipe: "+material.getLocalizedName()+" - Failed"); } - //Extruder - if (addExtruderRecipe( - ingotStackOne, - shape_Extruder, - plate_Single, - 10, 4 * tVoltageMultiplier)){ - Utils.LOG_INFO("Extruder Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Utils.LOG_INFO("Extruder Recipe: "+material.getLocalizedName()+" - Failed"); - } //Alloy Smelter if (GT_Values.RA.addAlloySmelterRecipe( ingotStackTwo, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_PleaseRefactorMe.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_PleaseRefactorMe.java new file mode 100644 index 0000000000..1919534ad0 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_PleaseRefactorMe.java @@ -0,0 +1,28 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.recipe.UtilsRecipe; + +public class RecipeGen_PleaseRefactorMe { + + public static void generateRecipes(Material material){ + int tVoltageMultiplier = material.getMeltingPoint_K() >= 2800 ? 64 : 16; + Utils.LOG_INFO("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO + //Ring Recipe + + if (UtilsRecipe.addShapedGregtechRecipe( + "craftingToolWrench", null, null, + null, material.getRod(1), null, + null, null, null, + material.getRing(1))){ + Utils.LOG_INFO("Ring Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Ring Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + + } +} 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..4f749005d5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java @@ -0,0 +1,121 @@ +package gtPlusPlus.xmod.gregtech.loaders; + +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.recipe.UtilsRecipe; +import net.minecraft.item.ItemStack; + +public class RecipeGen_ShapedCrafting { + + public static void generateRecipes(Material material){ + Utils.LOG_INFO("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO + //Ring Recipe + if (!material.isRadioactive){ + if (UtilsRecipe.addShapedGregtechRecipe( + "craftingToolWrench", null, null, + null, material.getRod(1), null, + null, null, null, + material.getRing(1))){ + Utils.LOG_INFO("Ring Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Ring Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + //Framebox Recipe + if (!material.isRadioactive){ + ItemStack stackStick = material.getRod(1); + if (UtilsRecipe.addShapedGregtechRecipe( + stackStick, stackStick, stackStick, + stackStick, "craftingToolWrench", stackStick, + stackStick, stackStick, stackStick, + material.getFrameBox(2))){ + Utils.LOG_INFO("Framebox Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Framebox Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + //Shaped Recipe - Bolts + if (!material.isRadioactive){ + if (UtilsRecipe.addShapedGregtechRecipe( + "craftingToolSaw", null, null, + null, material.getRod(1), null, + null, null, null, + material.getBolt(2))){ + Utils.LOG_INFO("Bolt Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Bolt Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + + //Shaped Recipe - Ingot to Rod + if (UtilsRecipe.addShapedGregtechRecipe( + "craftingToolFile", null, null, + null, material.getIngot(1), null, + null, null, null, + material.getRod(1))){ + Utils.LOG_INFO("Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + + //Shaped Recipe - Long Rod to two smalls + if (UtilsRecipe.addShapedGregtechRecipe( + "craftingToolSaw", null, null, + material.getLongRod(1), null, null, + null, null, null, + material.getRod(2))){ + Utils.LOG_INFO("Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + //Two small to long rod + if (UtilsRecipe.addShapedGregtechRecipe( + material.getRod(1), "craftingToolHardHammer", material.getRod(1), + null, null, null, + null, null, null, + material.getLongRod(1))){ + Utils.LOG_INFO("Long Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Long Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } + + //Rotor Recipe + if (!material.isRadioactive){ + if (UtilsRecipe.addShapedGregtechRecipe( + 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_INFO("Rotor Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Rotor Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + + //Screws + if (!material.isRadioactive){ + if (UtilsRecipe.addShapedGregtechRecipe( + "craftingToolFile", material.getBolt(1), null, + material.getBolt(1), null, null, + null, null, null, + material.getScrew(1))){ + Utils.LOG_INFO("Screw Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Utils.LOG_INFO("Screw Recipe: "+material.getLocalizedName()+" - Failed"); + } + } + } +} |