aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-12-24 13:28:40 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-12-24 13:28:40 +1000
commit733e82642363da011097666f91048b4da3c051eb (patch)
tree172489cb7b13f692a097e71f94f15c97677af145 /src/Java
parent9517bb948d41dfe0fe7a7db7493d083c495076c1 (diff)
downloadGT5-Unofficial-733e82642363da011097666f91048b4da3c051eb.tar.gz
GT5-Unofficial-733e82642363da011097666f91048b4da3c051eb.tar.bz2
GT5-Unofficial-733e82642363da011097666f91048b4da3c051eb.zip
$ Fixed an issue where recipeBuilder() could fail with a null.
+ Added a new constructor to material/MaterialGenerator.java which allows a true/false on what parts get generated. The old constructor was not removed, it just defaults to true for all parts to be generated. - Removed Lithium-7 Rotors, Screws, Rods, Long Rods, Gears, Bolts & Rings as a result of the previous addition. + Added some missing textures.
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java2
-rw-r--r--src/Java/gtPlusPlus/core/material/MaterialGenerator.java109
-rw-r--r--src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java5
3 files changed, 68 insertions, 48 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index fd5f7896c2..0060841291 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -241,7 +241,7 @@ public final class ModItems {
//The large neutron-absorption cross-section of lithium-6 (about 940 barns[5]) as compared with the very small
//neutron cross-section of lithium-7 (about 45 millibarns) makes high separation of lithium-7 from natural lithium a
//strong requirement for the possible use in lithium fluoride reactors.
- MaterialGenerator.generate(ELEMENT.getInstance().LITHIUM7);
+ MaterialGenerator.generate(ELEMENT.getInstance().LITHIUM7, false);
//Production of 233U (through the neutron irradiation of 232Th) invariably produces small amounts of 232U as an impurity
//because of parasitic (n,2n) reactions on uranium-233 itself, or on protactinium-233, or on thorium-232:
MaterialGenerator.generate(ELEMENT.getInstance().URANIUM232);
diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
index ec6527be50..693a54e5b6 100644
--- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
+++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
@@ -23,75 +23,92 @@ import net.minecraft.item.Item;
public class MaterialGenerator {
- @SuppressWarnings("unused")
public static void generate(final Material matInfo){
+ generate(matInfo, true);
+ }
+
+ public static void generate(final Material matInfo, boolean generateEverything){
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 {
+
+ if (generateEverything == true){
+ 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);
+ }
+ } 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 - old code
- RecipeGen_Plates.generateRecipes(matInfo);
- RecipeGen_Extruder.generateRecipes(matInfo);
- RecipeGen_ShapedCrafting.generateRecipes(matInfo);
- RecipeGen_DustGeneration.generateRecipes(matInfo);
- if (matInfo != ALLOY.ENERGYCRYSTAL && matInfo != ALLOY.BLOODSTEEL)
- RecipeGen_BlastSmelter.generateARecipe(matInfo);
-
- }
-}
+
+ }
+
+
+ //Add A jillion Recipes - old code
+ RecipeGen_Plates.generateRecipes(matInfo);
+ RecipeGen_Extruder.generateRecipes(matInfo);
+ RecipeGen_ShapedCrafting.generateRecipes(matInfo);
+ RecipeGen_DustGeneration.generateRecipes(matInfo);
+ if (matInfo != ALLOY.ENERGYCRYSTAL && matInfo != ALLOY.BLOODSTEEL)
+ RecipeGen_BlastSmelter.generateARecipe(matInfo);
+
+ }
+
+ }
diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
index d3aebdc759..5951d29c7e 100644
--- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
+++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
@@ -23,7 +23,10 @@ public class RecipeUtils {
public static boolean recipeBuilder(Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9, ItemStack resultItem){
ArrayList<Object> validSlots = new ArrayList<Object>();
-
+ if (resultItem == null){
+ return false;
+ }
+
Utils.LOG_INFO("Trying to add a recipe for "+resultItem.toString());
String a,b,c,d,e,f,g,h,i;
if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);}