diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-23 20:32:22 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-23 20:32:22 +1000 |
commit | 4e22125d6ddc878853cc3cadcec272a1a92e5135 (patch) | |
tree | bfab2239a40f54937ab7443e4f8ed896b37516da /src/Java/gtPlusPlus/core | |
parent | 6754387bca14ef3c2bdc5e69d0f4920ca7568553 (diff) | |
download | GT5-Unofficial-4e22125d6ddc878853cc3cadcec272a1a92e5135.tar.gz GT5-Unofficial-4e22125d6ddc878853cc3cadcec272a1a92e5135.tar.bz2 GT5-Unofficial-4e22125d6ddc878853cc3cadcec272a1a92e5135.zip |
- Disabled generation of Deci/Centi dusts for now.
+ Added a check for Growthcraft versioning, newer versions past 2.3.1 will not have extra support loaded.
+ Improved Chemical Compound tooltip generation on dusts.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r-- | src/Java/gtPlusPlus/core/item/ModItems.java | 4 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/lib/LoadedMods.java | 14 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/material/ELEMENT.java | 2 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/material/Material.java | 105 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/material/MaterialStack.java | 22 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java | 2 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java | 6 |
7 files changed, 117 insertions, 38 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 74ea3ed4d3..1a407e1fc6 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -279,8 +279,8 @@ public final class ModItems { for (Materials m : rm){ MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, m); MS_GTMATERIAL = UtilsItems.generateMultiShovel(gtStyleTools, m); - itemBaseDecidust = UtilsItems.generateDecidust(m); - itemBaseCentidust = UtilsItems.generateCentidust(m); + /*itemBaseDecidust = UtilsItems.generateDecidust(m); + itemBaseCentidust = UtilsItems.generateCentidust(m);*/ } //EnderIO Resources diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index ad7ab7b2c9..1585fe06b3 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -119,9 +119,17 @@ public class LoadedMods { totalMods++; } if (Loader.isModLoaded("Growthcraft") == true){ - Growthcraft = true; - Utils.LOG_INFO("Components enabled for: Growthcraft"); - totalMods++; + Utils.LOG_INFO("Growthcraft Version: "+getModVersion("Growthcraft")); + if (getModVersion("Growthcraft").equals("1.7.10-2.3.1")){ + //Load Growthcraft Compat + Growthcraft = true; + Utils.LOG_INFO("Components enabled for: Growthcraft"); + totalMods++; + } + else { + Growthcraft = false; + Utils.LOG_INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); + } } if (Loader.isModLoaded("CoFHCore") == true){ CoFHCore = true; diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 9c05e53165..f4eb12ec46 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -79,7 +79,7 @@ public final class ELEMENT { public static final Material THORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thorium); public static final Material URANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium); public static final Material PLUTONIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium); - public static final Material URANIUM233 = new Material("Uranium-233", new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, null, MaterialUtils.superscript("233U"), 0);//Not a GT Inherited Material + public static final Material URANIUM233 = new Material("Uranium-233", new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, null, MaterialUtils.superscript("233U"), 2);//Not a GT Inherited Material } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 27a9f53ced..db83799039 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -1,18 +1,25 @@ package gtPlusPlus.core.material; +import static gregtech.api.enums.GT_Values.M; +import gregtech.api.enums.OrePrefixes; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.UtilsItems; import gtPlusPlus.core.util.math.MathUtils; + +import java.util.ArrayList; +import java.util.List; + import net.minecraft.item.ItemStack; public class Material { final String unlocalizedName; final String localizedName; - + protected Object dataVar; private MaterialStack[] materialInput = new MaterialStack[4]; + final List<MaterialStack> mMaterialList = new ArrayList<MaterialStack>(); final short[] RGBA; @@ -30,16 +37,17 @@ public class Material { public final int vTier; public final int vVoltageMultiplier; public final String vChemicalFormula; + public final String vChemicalSymbol; public Material(String materialName, short[] rgba, int meltingPoint, int boilingPoint, long protons, long neutrons, boolean blastFurnace, MaterialStack[] inputs){ this(materialName, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, inputs, "", 0); } - + public Material(String materialName, short[] rgba, int meltingPoint, int boilingPoint, long protons, long neutrons, boolean blastFurnace, MaterialStack[] inputs, int radiationLevel){ this(materialName, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, inputs, "", radiationLevel); } - public Material(String materialName, short[] rgba, int meltingPoint, int boilingPoint, long protons, long neutrons, boolean blastFurnace, MaterialStack[] inputs, String chemicalFormula, int radiationLevel){ + public Material(String materialName, short[] rgba, int meltingPoint, int boilingPoint, long protons, long neutrons, boolean blastFurnace, MaterialStack[] inputs, String chemicalSymbol, int radiationLevel){ this.unlocalizedName = Utils.sanitizeString(materialName); this.localizedName = materialName; @@ -54,13 +62,19 @@ public class Material { this.vProtons = protons; this.vNeutrons = neutrons; this.vMass = getMass(); - if (chemicalFormula.equals("")){ - this.vChemicalFormula = getChemicalFormula(inputs); - } - else{ - this.vChemicalFormula = chemicalFormula; + + //List<MaterialStack> inputArray = Arrays.asList(inputs); + if (inputs != null){ + if (inputs.length != 0){ + for (int x=0;x<inputs.length;x++) + this.mMaterialList.add(inputs[x]); + } } - + + + this.vChemicalSymbol = chemicalSymbol; + this.vChemicalFormula = getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); + if (radiationLevel != 0){ this.isRadioactive = true; this.vRadioationLevel = (byte) radiationLevel; @@ -119,10 +133,11 @@ public class Material { } } } - + dataVar = MathUtils.generateSingularRandomHexValue(); - + Utils.LOG_INFO("Creating a Material instance for "+materialName); + Utils.LOG_INFO("Formula: "+vChemicalFormula); Utils.LOG_INFO("Protons: "+vProtons); Utils.LOG_INFO("Neutrons: "+vNeutrons); Utils.LOG_INFO("Mass: "+vMass+"/units"); @@ -143,7 +158,7 @@ public class Material { } public int getRgbAsHex(){ - + int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); if (returnValue == 0){ return (int) dataVar; @@ -218,27 +233,27 @@ public class Material { public ItemStack getRod(int stacksize){ return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("stick"+unlocalizedName, stacksize); } - + public ItemStack getLongRod(int stacksize){ return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("stickLong"+unlocalizedName, stacksize); } - + public ItemStack getBolt(int stacksize){ return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("bolt"+unlocalizedName, stacksize); } - + public ItemStack getScrew(int stacksize){ return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("screw"+unlocalizedName, stacksize); } - + public ItemStack getRing(int stacksize){ return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("ring"+unlocalizedName, stacksize); } - + public ItemStack getRotor(int stacksize){ return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("rotor"+unlocalizedName, stacksize); } - + public ItemStack getFrameBox(int stacksize){ return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("frameGt"+unlocalizedName, stacksize); } @@ -284,19 +299,19 @@ public class Material { -private int getInputMaterialCount(MaterialStack[] materialInput){ - int i = 0; - for (int r=0;r<4;r++){ - try { - if (!materialInput[r].equals(null)){ - i++; + private int getInputMaterialCount(MaterialStack[] materialInput){ + int i = 0; + for (int r=0;r<4;r++){ + try { + if (!materialInput[r].equals(null)){ + i++; + } + } catch(Throwable x){ + return i; } - } catch(Throwable x){ - return i; } + return i; } - return i; -} public String getChemicalFormula(MaterialStack[] materialInput){ @@ -306,8 +321,8 @@ private int getInputMaterialCount(MaterialStack[] materialInput){ for (int i=0;i<f;i++){ try { if (materialInput[i] != null){ - formulaComponents[i] = materialInput[i].stackMaterial.vChemicalFormula; - Utils.LOG_INFO("LOOK AT ME IN THE LOG - " + formulaComponents[i]); + formulaComponents[i] = materialInput[i].stackMaterial.vChemicalFormula; + Utils.LOG_INFO("LOOK AT ME IN THE LOG - " + formulaComponents[i]); } else{ Utils.LOG_INFO("LOOK AT ME IN THE LOG - materialInput[i] was null"); @@ -332,6 +347,36 @@ private int getInputMaterialCount(MaterialStack[] materialInput){ } + public String getToolTip(String chemSymbol, long aMultiplier, boolean aShowQuestionMarks) { + if (!aShowQuestionMarks && (vChemicalFormula.equals("?")||vChemicalFormula.equals("??"))) return ""; + + Utils.LOG_INFO("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); + Utils.LOG_INFO("aMultiplier: "+aMultiplier); + Utils.LOG_INFO("aMultiplier >= M * 2: "+aMultiplier+" >= "+M * 2); + Utils.LOG_INFO("aMultiplier >= M * 2: "+(aMultiplier >= M * 2)); + Utils.LOG_INFO("!mMaterialList.isEmpty(): "+!mMaterialList.isEmpty()); + Utils.LOG_INFO("mMaterialList.size(): "+mMaterialList.size()); + Utils.LOG_INFO("mMaterialList.size() < 2: "+(mMaterialList.size() < 2)); + if (mMaterialList.size() != 0) + Utils.LOG_INFO("mMaterialList.get(0).vAmount: "+mMaterialList.get(0).vAmount); + if (mMaterialList.size() != 0) + Utils.LOG_INFO("mMaterialList.get(0).vAmount == 1: "+(mMaterialList.get(0).vAmount==1)); + Utils.LOG_INFO("===============| Finished Calculating data for "+this.localizedName+" |==============="); + Utils.LOG_INFO(""); + + if (aMultiplier >= M * 2 && !mMaterialList.isEmpty()) { + if(((chemSymbol != null && !chemSymbol.equals("")) || (mMaterialList.size() < 2 && mMaterialList.get(0).vAmount == 1))){ + return vChemicalFormula + aMultiplier; + } + return "(" + vChemicalFormula + ")" + aMultiplier; + } + if (!chemSymbol.equals("")) + return chemSymbol; + return "??"; + + } + + diff --git a/src/Java/gtPlusPlus/core/material/MaterialStack.java b/src/Java/gtPlusPlus/core/material/MaterialStack.java index 3682b73cfe..5e076e6e70 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialStack.java +++ b/src/Java/gtPlusPlus/core/material/MaterialStack.java @@ -5,6 +5,7 @@ import net.minecraft.item.ItemStack; public class MaterialStack { + final int vAmount; final Material stackMaterial; final double percentageToUse; @@ -12,6 +13,7 @@ public class MaterialStack { this.stackMaterial = inputs; this.percentageToUse = percentage; + this.vAmount = getDustCount(); } @@ -60,6 +62,26 @@ public class MaterialStack { } + public int getDustCount(){ + int amount = 0; + if (percentageToUse >= 0 && percentageToUse <= 0.99){ + amount = (int) (1/percentageToUse); + } + else if (percentageToUse >= 1 && percentageToUse <= 9.99){ + amount = (int) (percentageToUse); + } + else if (percentageToUse >= 10 && percentageToUse <= 99.99){ + amount = (int) (percentageToUse/10); + } + else if (percentageToUse == 100){ + amount = 10; + } + else { + amount = 0; + } + return amount; + } + public ItemStack[] getValidItemStacks(){ return UtilsItems.validItemsForOreDict(stackMaterial.unlocalizedName); } diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index 61171e3688..52e925df0e 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -60,6 +60,8 @@ public class MaterialUtils { radioactivity = 1; } if (hasValidRGBA(rgba)){ + //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); + //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material); return new Material(name, rgba, melting, boiling, protons, neutrons, blastFurnace, null, chemicalFormula, radioactivity); } return null; diff --git a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java b/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java index 624bde2ead..ee582c0646 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java +++ b/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java @@ -23,7 +23,7 @@ import cpw.mods.fml.common.registry.GameRegistry; public class UtilsRecipe { - public static void 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){ + 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>(); @@ -108,6 +108,7 @@ public class UtilsRecipe { else { LateRegistrationHandler.recipesSuccess++; } + return true; } catch(NullPointerException | ClassCastException k){ k.getMessage(); @@ -120,7 +121,8 @@ public class UtilsRecipe { } else { LateRegistrationHandler.recipesFailed++; - } + } + return false; } } |