aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/material/Material.java
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-26 15:46:55 +0100
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-26 15:46:55 +0100
commit2cf05c4deaf3a26626853431f725d0ca375ffec3 (patch)
tree025ae135b88af6b9a0437a3721bcc2dec9ccc3e3 /src/Java/gtPlusPlus/core/material/Material.java
parente9dbe58c39b56d562bcdc17b1100a7c26ce7c10e (diff)
downloadGT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.tar.gz
GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.tar.bz2
GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.zip
+ Added 4 new High-Tier Alloys. Lafium, Cinobite, Pikyonite & Abyssal.
+ Added missing Germanium Dust. + Added compatibility for Witchery. - Removed portability of Tanks for GTNH, tanks are still portable otherwise. $ Fixed calculations for automatic recipe generation, EBF and ABS recipe requirements for GT++ Alloys are now significantly increased. $ Fixed missing Control Core textures. % Cleaned up some recipe generation. % Improved Material.java.
Diffstat (limited to 'src/Java/gtPlusPlus/core/material/Material.java')
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java198
1 files changed, 82 insertions, 116 deletions
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java
index 01999ecbd4..4dd88030bd 100644
--- a/src/Java/gtPlusPlus/core/material/Material.java
+++ b/src/Java/gtPlusPlus/core/material/Material.java
@@ -255,17 +255,39 @@ public class Material {
this.isRadioactive = true;
this.vRadiationLevel = (byte) radiationLevel;
}
- else {
- Logger.MATERIALS(this.getLocalizedName()+" is not radioactive.");
- this.isRadioactive = false;
- this.vRadiationLevel = 0;
+ else {
+ if (vMaterialInput.size() > 0) {
+ AutoMap<Byte> aDataSet = new AutoMap<Byte>();
+ for (MaterialStack m : this.vMaterialInput) {
+ aDataSet.put(m.getStackMaterial().vRadiationLevel);
+ }
+ byte aAverage = MathUtils.getByteAverage(aDataSet);
+ if (aAverage > Byte.MAX_VALUE || aAverage < Byte.MIN_VALUE) {
+ aAverage = 0;
+ }
+ if (aAverage > 0) {
+ Logger.MATERIALS(this.getLocalizedName()+" is radioactive due to trace elements. Level: "+aAverage+".");
+ this.isRadioactive = true;
+ this.vRadiationLevel = (byte) aAverage;
+ }
+ else {
+ Logger.MATERIALS(this.getLocalizedName()+" is not radioactive.");
+ this.isRadioactive = false;
+ this.vRadiationLevel = 0;
+ }
+ }
+ else {
+ Logger.MATERIALS(this.getLocalizedName()+" is not radioactive.");
+ this.isRadioactive = false;
+ this.vRadiationLevel = 0;
+ }
}
//Sets the materials 'tier'. Will probably replace this logic.
this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint));
this.usesBlastFurnace = blastFurnace;
- this.vVoltageMultiplier = this.getMeltingPointK() >= 2800 ? 60 : 15;
+ this.vVoltageMultiplier = MaterialUtils.getVoltageForTier(vTier);
this.vComponentCount = this.getComponentCount(inputs);
this.vSmallestRatio = this.getSmallestRatio(this.vMaterialInput);
@@ -288,11 +310,11 @@ public class Material {
this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true);
}
else if (!this.vChemicalSymbol.equals("")){
- Logger.WARNING("materialInput is null, using a valid chemical symbol.");
+ Logger.MATERIALS("materialInput is null, using a valid chemical symbol.");
this.vChemicalFormula = this.vChemicalSymbol;
}
else{
- Logger.WARNING("MaterialInput == null && chemicalSymbol probably equals nothing");
+ Logger.MATERIALS("MaterialInput == null && chemicalSymbol probably equals nothing");
this.vChemicalFormula = "??";
}
@@ -335,13 +357,13 @@ public class Material {
}
}
- Logger.WARNING("Creating a Material instance for "+materialName);
- Logger.WARNING("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio);
- Logger.WARNING("Protons: "+this.vProtons);
- Logger.WARNING("Neutrons: "+this.vNeutrons);
- Logger.WARNING("Mass: "+this.vMass+"/units");
- Logger.WARNING("Melting Point: "+this.meltingPointC+"C.");
- Logger.WARNING("Boiling Point: "+this.boilingPointC+"C.");
+ Logger.MATERIALS("Creating a Material instance for "+materialName);
+ Logger.MATERIALS("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio);
+ Logger.MATERIALS("Protons: "+this.vProtons);
+ Logger.MATERIALS("Neutrons: "+this.vNeutrons);
+ Logger.MATERIALS("Mass: "+this.vMass+"/units");
+ Logger.MATERIALS("Melting Point: "+this.meltingPointC+"C.");
+ Logger.MATERIALS("Boiling Point: "+this.boilingPointC+"C.");
}
catch (Throwable t){
t.printStackTrace();
@@ -487,6 +509,10 @@ public class Material {
return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingot"+this.unlocalizedName, stacksize);
}
+ public final ItemStack getHotIngot(final int stacksize){
+ return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHot"+this.unlocalizedName, stacksize);
+ }
+
public final ItemStack getPlate(final int stacksize){
return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plate"+this.unlocalizedName, stacksize);
}
@@ -595,21 +621,21 @@ public class Material {
if (this.vMaterialInput != null && !this.vMaterialInput.isEmpty()){
final ItemStack[] temp = new ItemStack[this.vMaterialInput.size()];
for (int i=0;i<this.vMaterialInput.size();i++){
- //Utils.LOG_WARNING("i:"+i);
+ //Utils.LOG_MATERIALS("i:"+i);
ItemStack testNull = null;
try {
testNull = this.vMaterialInput.get(i).getValidStack();
} catch (final Throwable r){
- Logger.WARNING("Failed gathering material stack for "+this.localizedName+".");
- Logger.WARNING("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i);
+ Logger.MATERIALS("Failed gathering material stack for "+this.localizedName+".");
+ Logger.MATERIALS("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i);
}
try {
if (testNull != null){
- //Utils.LOG_WARNING("not null");
+ //Utils.LOG_MATERIALS("not null");
temp[i] = this.vMaterialInput.get(i).getValidStack();
}
} catch (final Throwable r){
- Logger.WARNING("Failed setting slot "+i+", using "+this.localizedName);
+ Logger.MATERIALS("Failed setting slot "+i+", using "+this.localizedName);
}
}
return temp;
@@ -659,9 +685,9 @@ public class Material {
public final long[] getSmallestRatio(final ArrayList<MaterialStack> tempInput){
if (tempInput != null){
if (!tempInput.isEmpty()){
- Logger.WARNING("length: "+tempInput.size());
- Logger.WARNING("(inputs != null): "+(tempInput != null));
- //Utils.LOG_WARNING("length: "+inputs.length);
+ Logger.MATERIALS("length: "+tempInput.size());
+ Logger.MATERIALS("(inputs != null): "+(tempInput != null));
+ //Utils.LOG_MATERIALS("length: "+inputs.length);
final long[] tempRatio = new long[tempInput.size()];
for (int x=0;x<tempInput.size();x++){
//tempPercentage = tempPercentage+inputs[x].percentageToUse;
@@ -678,7 +704,7 @@ public class Material {
for (int r=0;r<tempRatio.length;r++){
tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] +" : ";
}
- Logger.WARNING("Default Ratio: "+tempRatioStringThing1);
+ Logger.MATERIALS("Default Ratio: "+tempRatioStringThing1);
String tempRatioStringThing = "";
int tempSmallestCraftingUseSize = 0;
@@ -687,7 +713,7 @@ public class Material {
tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]);
}
//this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize;
- Logger.WARNING("Smallest Ratio: "+tempRatioStringThing);
+ Logger.MATERIALS("Smallest Ratio: "+tempRatioStringThing);
return smallestRatio;
}
}
@@ -699,7 +725,7 @@ public class Material {
if (!aShowQuestionMarks && (this.vChemicalFormula.equals("?")||this.vChemicalFormula.equals("??"))) {
return "";
}
- Logger.WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |===============");
+ Logger.MATERIALS("===============| Calculating Atomic Formula for "+this.localizedName+" |===============");
if (!chemSymbol.equals("")) {
return chemSymbol;
}
@@ -742,13 +768,13 @@ public class Material {
return StringUtils.subscript(dummyFormula);
//return dummyFormula;
}
- Logger.WARNING("dummyFormulaArray <= 0");
+ Logger.MATERIALS("dummyFormulaArray <= 0");
}
- Logger.WARNING("dummyFormulaArray == null");
+ Logger.MATERIALS("dummyFormulaArray == null");
}
- Logger.WARNING("tempInput.length <= 0");
+ Logger.MATERIALS("tempInput.length <= 0");
}
- Logger.WARNING("tempInput == null");
+ Logger.MATERIALS("tempInput == null");
return "??";
}
@@ -778,33 +804,33 @@ public class Material {
if (isValid != Materials._NULL){
for (Materials m : invalidMaterials.values()){
if (isValid == m){
- Logger.WARNING("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName);
+ Logger.MATERIALS("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName);
FluidStack a1 = m.getFluid(1);
FluidStack a2 = m.getGas(1);
FluidStack a3 = m.getMolten(1);
FluidStack a4 = m.getSolid(1);
FluidStack a5 = m.getPlasma(1);
if (a1 != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. Fluid.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. Fluid.");
return a1.getFluid();
}
if (a2 != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. Gas.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. Gas.");
return a2.getFluid();
}
if (a3 != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. Molten.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. Molten.");
return a3.getFluid();
}
if (a4 != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. Solid.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. Solid.");
return a4.getFluid();
}
if (a5 != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. Plasma.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. Plasma.");
return a5.getFluid();
}
- Logger.WARNING("Using null.");
+ Logger.MATERIALS("Using null.");
return null;
}
}
@@ -812,31 +838,31 @@ public class Material {
if (this.materialState == MaterialState.SOLID){
if (isValid.mFluid != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. mFluid.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid.");
return isValid.mFluid;
}
else if (isValid.mStandardMoltenFluid != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid.");
return isValid.mStandardMoltenFluid;
}
}
else if (this.materialState == MaterialState.GAS){
if (isValid.mGas != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. mGas.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas.");
return isValid.mGas;
}
}
else if (this.materialState == MaterialState.LIQUID || this.materialState == MaterialState.PURE_LIQUID){
if (isValid.mFluid != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. mFluid.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid.");
return isValid.mFluid;
}
else if (isValid.mGas != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. mGas.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas.");
return isValid.mGas;
}
else if (isValid.mStandardMoltenFluid != null){
- Logger.WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid.");
+ Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid.");
return isValid.mStandardMoltenFluid;
}
}
@@ -846,28 +872,28 @@ public class Material {
FluidStack aTest3 = FluidUtils.getFluidStack(Utils.sanitizeString(this.getLocalizedName()), 1);
if (aTest1 != null) {
- Logger.WARNING("Found FluidRegistry entry for "+"molten."+Utils.sanitizeString(this.getLocalizedName()));
+ Logger.MATERIALS("Found FluidRegistry entry for "+"molten."+Utils.sanitizeString(this.getLocalizedName()));
return aTest1.getFluid();
}
if (aTest2 != null) {
- Logger.WARNING("Found FluidRegistry entry for "+"fluid."+Utils.sanitizeString(this.getLocalizedName()));
+ Logger.MATERIALS("Found FluidRegistry entry for "+"fluid."+Utils.sanitizeString(this.getLocalizedName()));
return aTest2.getFluid();
}
if (aTest3 != null) {
- Logger.WARNING("Found FluidRegistry entry for "+Utils.sanitizeString(this.getLocalizedName()));
+ Logger.MATERIALS("Found FluidRegistry entry for "+Utils.sanitizeString(this.getLocalizedName()));
return aTest3.getFluid();
}
- Logger.WARNING("Generating our own fluid.");
+ Logger.MATERIALS("Generating our own fluid.");
//Generate a Cell if we need to
if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){
if (this.vGenerateCells){
new BaseItemCell(this);
- Logger.WARNING("Generated a cell for "+this.getUnlocalizedName());
+ Logger.MATERIALS("Generated a cell for "+this.getUnlocalizedName());
}
else {
- Logger.WARNING("Did not generate a cell for "+this.getUnlocalizedName());
+ Logger.MATERIALS("Did not generate a cell for "+this.getUnlocalizedName());
}
}
@@ -924,11 +950,11 @@ public class Material {
}
}
if (isValid.mPlasma != null){
- Logger.WARNING("Using a pre-defined Plasma from GT.");
+ Logger.MATERIALS("Using a pre-defined Plasma from GT.");
return isValid.mPlasma;
}
- Logger.WARNING("Generating our own Plasma.");
+ Logger.MATERIALS("Generating our own Plasma.");
return FluidUtils.addGTPlasma(this);
}
@@ -950,27 +976,8 @@ public class Material {
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getMeltingPointC());
}
- long aAverage = MathUtils.getAverage(aDataSet);
+ long aAverage = MathUtils.getLongAverage(aDataSet);
return MathUtils.safeInt(aAverage);
-
-
-
-
- /*int meltingPoint = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- int incrementor = part.getStackMaterial().getMeltingPointC();
- meltingPoint += incrementor;
- Logger.WARNING("Melting Point for "+this.getLocalizedName()+" increased by "+ incrementor);
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
- }
- }
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- Logger.WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point.");
- meltingPoint = (meltingPoint/divisor);
- return meltingPoint;*/
}
catch (Throwable r){
return 500;
@@ -984,23 +991,8 @@ public class Material {
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getBoilingPointC());
}
- long aAverage = MathUtils.getAverage(aDataSet);
+ long aAverage = MathUtils.getLongAverage(aDataSet);
return MathUtils.safeInt(aAverage);
-
-
- /*int boilingPoint = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- boilingPoint += part.getStackMaterial().getBoilingPointC();
- Logger.WARNING("Boiling Point for "+this.getLocalizedName()+" increased by "+ part.getStackMaterial().getBoilingPointC());
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
- }
- }
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- boilingPoint = (boilingPoint/divisor);
- return boilingPoint;*/
}
catch (Throwable r){
return 2500;
@@ -1014,21 +1006,8 @@ public class Material {
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getProtons());
}
- long aAverage = MathUtils.getAverage(aDataSet);
- return aAverage;
-
- /*long protonCount = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- protonCount += (part.getStackMaterial().getProtons());
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
- }
- }
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- protonCount = (protonCount/divisor);
- return protonCount;*/
+ long aAverage = MathUtils.getLongAverage(aDataSet);
+ return MathUtils.safeInt(aAverage);
}
catch (Throwable r){
return 50;
@@ -1042,21 +1021,8 @@ public class Material {
for (MaterialStack m : this.vMaterialInput) {
aDataSet.put(m.getStackMaterial().getNeutrons());
}
- long aAverage = MathUtils.getAverage(aDataSet);
- return aAverage;
-
- /*long neutronCount = 0;
- for (MaterialStack part : this.vMaterialInput){
- if (part != null){
- neutronCount += (part.getStackMaterial().getNeutrons());
- }
- else {
- Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition.");
- }
- }
- int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
- neutronCount = (neutronCount/divisor);
- return neutronCount;*/
+ long aAverage = MathUtils.getLongAverage(aDataSet);
+ return MathUtils.safeInt(aAverage);
}
catch (Throwable r){
return 75;