From 84cce1bba9a1091f2428ebee464cbfdf57491def Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 13 Sep 2018 13:27:29 +1000 Subject: + Added some Average functions to MathUtils.java. + Added a Proxy Grabber function to Meta_GT_Proxy.java. % Tweaked fuel values for Coal Gas & Coal Tar. $ Fixed issue with Semifluid Fuel generation where none were excluded. - Removed Logging from material Generation. --- .../gtPlusPlus/core/item/chemistry/CoalTar.java | 34 ++++---- src/Java/gtPlusPlus/core/material/Material.java | 96 +++++++++++----------- src/Java/gtPlusPlus/core/util/math/MathUtils.java | 19 +++++ .../xmod/gregtech/common/Meta_GT_Proxy.java | 41 ++++++++- 4 files changed, 123 insertions(+), 67 deletions(-) (limited to 'src/Java/gtPlusPlus') diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java index 80f1828be3..1fb629976a 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java @@ -23,21 +23,21 @@ import net.minecraftforge.fluids.FluidStack; public class CoalTar { - private static Fluid Coal_Gas; - private static Fluid Ethylene; - private static Fluid Benzene; - private static Fluid Ethylbenzene; - private static Fluid Anthracene; - private static Fluid Toluene; - private static Fluid Coal_Tar; - private static Fluid Coal_Tar_Oil; - private static Fluid Sulfuric_Coal_Tar_Oil; - private static Fluid Naphthalene; - private static Fluid Phthalic_Acid; - private static Fluid Ethylanthraquinone2; - private static Fluid Ethylanthrahydroquinone2; - private static Fluid Hydrogen_Peroxide; - private static Fluid Lithium_Peroxide; + public static Fluid Coal_Gas; + public static Fluid Ethylene; + public static Fluid Benzene; + public static Fluid Ethylbenzene; + public static Fluid Anthracene; + public static Fluid Toluene; + public static Fluid Coal_Tar; + public static Fluid Coal_Tar_Oil; + public static Fluid Sulfuric_Coal_Tar_Oil; + public static Fluid Naphthalene; + public static Fluid Phthalic_Acid; + public static Fluid Ethylanthraquinone2; + public static Fluid Ethylanthrahydroquinone2; + public static Fluid Hydrogen_Peroxide; + public static Fluid Lithium_Peroxide; public static void run(){ @@ -105,10 +105,10 @@ public class CoalTar { Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null); //Burn the coal gas! - GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 64, 1); + GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1); GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricCoalTarOil", 1), null, 32, 3); GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTarOil", 1), null, 64, 3); - GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTar", 1), null, 192, 3); + GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTar", 1), null, 128, 3); createRecipes(); diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index cf8ded80e9..7d251c8682 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -288,11 +288,11 @@ public class Material { this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); } else if (!this.vChemicalSymbol.equals("")){ - Logger.INFO("materialInput is null, using a valid chemical symbol."); + Logger.WARNING("materialInput is null, using a valid chemical symbol."); this.vChemicalFormula = this.vChemicalSymbol; } else{ - Logger.INFO("MaterialInput == null && chemicalSymbol probably equals nothing"); + Logger.WARNING("MaterialInput == null && chemicalSymbol probably equals nothing"); this.vChemicalFormula = "??"; } @@ -335,13 +335,13 @@ public class Material { } } - Logger.INFO("Creating a Material instance for "+materialName); - Logger.INFO("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); - Logger.INFO("Protons: "+this.vProtons); - Logger.INFO("Neutrons: "+this.vNeutrons); - Logger.INFO("Mass: "+this.vMass+"/units"); - Logger.INFO("Melting Point: "+this.meltingPointC+"C."); - Logger.INFO("Boiling Point: "+this.boilingPointC+"C."); + 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."); } catch (Throwable t){ t.printStackTrace(); @@ -595,21 +595,21 @@ public class Material { if (this.vMaterialInput != null && !this.vMaterialInput.isEmpty()){ final ItemStack[] temp = new ItemStack[this.vMaterialInput.size()]; for (int i=0;i tempInput){ if (tempInput != null){ if (!tempInput.isEmpty()){ - Logger.INFO("length: "+tempInput.size()); - Logger.INFO("(inputs != null): "+(tempInput != null)); - //Utils.LOG_INFO("length: "+inputs.length); + Logger.WARNING("length: "+tempInput.size()); + Logger.WARNING("(inputs != null): "+(tempInput != null)); + //Utils.LOG_WARNING("length: "+inputs.length); final long[] tempRatio = new long[tempInput.size()]; for (int x=0;x0 ? this.vMaterialInput.size() : 1); - Logger.INFO("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); + Logger.WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); meltingPoint = (meltingPoint/divisor); return meltingPoint; } @@ -972,7 +972,7 @@ public class Material { for (MaterialStack part : this.vMaterialInput){ if (part != null){ boilingPoint += part.getStackMaterial().getBoilingPointC(); - Logger.INFO("Boiling Point for "+this.getLocalizedName()+" increased by "+ 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."); diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index cda463ff10..7ec898ce3a 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -6,6 +6,7 @@ import java.util.Random; import gregtech.api.enums.GT_Values; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -374,5 +375,23 @@ public class MathUtils { return mLargeChanceArray[randInt(0, mLargeChanceArray.length-1)]; } + + public static long getAverage(AutoMap aDataSet) { + long[] aNewSet = new long[aDataSet.size()]; + for (int u=0;u