aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/material
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-10-27 04:37:30 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-10-27 04:37:30 +1000
commit3e2a9a9cf154f717696ae391fe8b998a6e3bbd29 (patch)
treeab9178162a23255bd31423694352f4d0e6b7f3de /src/Java/gtPlusPlus/core/material
parent9fa6dce3449e8d339ee8b81544ccf073bc350745 (diff)
downloadGT5-Unofficial-3e2a9a9cf154f717696ae391fe8b998a6e3bbd29.tar.gz
GT5-Unofficial-3e2a9a9cf154f717696ae391fe8b998a6e3bbd29.tar.bz2
GT5-Unofficial-3e2a9a9cf154f717696ae391fe8b998a6e3bbd29.zip
+ Made Recipes and Material init all runnable classes, now items should generate in a proper fashion.
$ Fixed the Alloy Blast Furnace using the wrong recipe map and not outputting fluids. % Separated GT Material and my Material recipe generation for the Blast Alloy Smelter.
Diffstat (limited to 'src/Java/gtPlusPlus/core/material')
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java6
-rw-r--r--src/Java/gtPlusPlus/core/material/MaterialGenerator.java108
2 files changed, 112 insertions, 2 deletions
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java
index d73ac96bec..893b310ba4 100644
--- a/src/Java/gtPlusPlus/core/material/Material.java
+++ b/src/Java/gtPlusPlus/core/material/Material.java
@@ -27,7 +27,7 @@ public class Material {
protected Object dataVar;
- private ArrayList<MaterialStack> vMaterialInput;
+ private ArrayList<MaterialStack> vMaterialInput = new ArrayList<MaterialStack>();
public final long[] vSmallestRatio;
private final short[] RGBA;
@@ -98,7 +98,7 @@ public class Material {
if (inputs.length != 0){
for (int i=0; i < inputs.length; i++){
if (inputs[i] != null){
- this.vMaterialInput.set(i, inputs[i]);
+ this.vMaterialInput.add(i, inputs[i]);
}
}
}
@@ -288,6 +288,7 @@ public class Material {
final public ItemStack[] getMaterialComposites(){
//Utils.LOG_WARNING("Something requested the materials needed for "+localizedName);
+ if (vMaterialInput != null){
if (!vMaterialInput.isEmpty()){
ItemStack[] temp = new ItemStack[vMaterialInput.size()];
for (int i=0;i<vMaterialInput.size();i++){
@@ -310,6 +311,7 @@ public class Material {
}
return temp;
}
+ }
return new ItemStack[]{};
}
diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
new file mode 100644
index 0000000000..55014f5ee8
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
@@ -0,0 +1,108 @@
+package gtPlusPlus.core.material;
+
+import gtPlusPlus.core.block.base.BasicBlock.BlockTypes;
+import gtPlusPlus.core.block.base.BlockBaseModular;
+import gtPlusPlus.core.item.base.bolts.BaseItemBolt;
+import gtPlusPlus.core.item.base.dusts.BaseItemDust;
+import gtPlusPlus.core.item.base.gears.BaseItemGear;
+import gtPlusPlus.core.item.base.ingots.BaseItemIngot;
+import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot;
+import gtPlusPlus.core.item.base.nugget.BaseItemNugget;
+import gtPlusPlus.core.item.base.plates.BaseItemPlate;
+import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble;
+import gtPlusPlus.core.item.base.rings.BaseItemRing;
+import gtPlusPlus.core.item.base.rods.BaseItemRod;
+import gtPlusPlus.core.item.base.rods.BaseItemRodLong;
+import gtPlusPlus.core.item.base.rotors.BaseItemRotor;
+import gtPlusPlus.core.item.base.screws.BaseItemScrew;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.item.ItemUtils;
+import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelter;
+import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration;
+import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Extruder;
+import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates;
+import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting;
+import net.minecraft.block.Block;
+import net.minecraft.item.Item;
+
+public class MaterialGenerator implements Runnable {
+
+ final Material toGenerate;
+
+ public MaterialGenerator(final Material M){
+ this.toGenerate = M;
+ }
+
+ @Override
+ public void run() {
+ generateItemsFromMaterial(toGenerate);
+ }
+
+
+ public static void generateItemsFromMaterial(final Material matInfo){
+ String unlocalizedName = matInfo.getUnlocalizedName();
+ String materialName = matInfo.getLocalizedName();
+ short[] C = matInfo.getRGBA();
+ int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]);
+ boolean hotIngot = matInfo.requiresBlastFurnace();
+ int materialTier = matInfo.vTier; //TODO
+
+ if (materialTier > 10 || materialTier <= 0){
+ materialTier = 2;
+ }
+
+ int sRadiation = 0;
+ if (ItemUtils.isRadioactive(materialName)){
+ sRadiation = ItemUtils.getRadioactivityLevel(materialName);
+ }
+
+ if (sRadiation >= 1){
+ Item temp;
+ Block tempBlock;
+ tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour);
+ temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation);
+
+ temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation);
+ temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation);
+ temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation);
+ temp = new BaseItemNugget(matInfo);
+ temp = new BaseItemPlate(matInfo);
+ temp = new BaseItemRod(matInfo);
+ temp = new BaseItemRodLong(matInfo);
+ }
+
+ else {
+ Item temp;
+ Block tempBlock;
+ tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour);
+ tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.FRAME, Colour);
+ temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation);
+ if (hotIngot){
+ Item tempIngot = temp;
+ temp = new BaseItemIngotHot("itemHotIngot"+unlocalizedName, materialName, ItemUtils.getSimpleStack(tempIngot, 1), materialTier);
+ }
+ temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation);
+ temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation);
+ temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation);
+ temp = new BaseItemNugget(matInfo);
+ temp = new BaseItemPlate(matInfo);
+ temp = new BaseItemPlateDouble(matInfo);
+ temp = new BaseItemBolt(matInfo);
+ temp = new BaseItemRod(matInfo);
+ temp = new BaseItemRodLong(matInfo);
+ temp = new BaseItemRing(matInfo);
+ temp = new BaseItemScrew(matInfo);
+ temp = new BaseItemRotor(matInfo);
+ temp = new BaseItemGear(matInfo);
+ }
+
+ //Add A jillion Recipes
+ RecipeGen_Plates.generateRecipes(matInfo);
+ RecipeGen_Extruder.generateRecipes(matInfo);
+ RecipeGen_ShapedCrafting.generateRecipes(matInfo);
+ RecipeGen_DustGeneration.generateRecipes(matInfo);
+ RecipeGen_BlastSmelter.generateARecipe(matInfo);
+
+ }
+
+}