diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
11 files changed, 273 insertions, 133 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index e532071d26..22727fa130 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -15,6 +15,7 @@ import cpw.mods.fml.common.event.*; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Materials; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; @@ -29,6 +30,7 @@ import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.handler.events.BlockEventHandler; import gtPlusPlus.core.handler.events.LoginEventHandler; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.geo.GeoUtils; import gtPlusPlus.core.util.item.ItemUtils; @@ -79,6 +81,7 @@ public class GTplusplus implements ActionListener { //Give this a go mate. initAnalytics(); + setupMaterialBlacklist(); //HTTP Requests CORE.MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); @@ -189,4 +192,34 @@ public class GTplusplus implements ActionListener { new SegmentHelper(); } + + private static final boolean setupMaterialBlacklist(){ + int ID = 0; + Material.invalidMaterials.put(ID++, Materials._NULL); + Material.invalidMaterials.put(ID++, Materials.Clay); + Material.invalidMaterials.put(ID++, Materials.Phosphorus); + Material.invalidMaterials.put(ID++, Materials.Steel); + Material.invalidMaterials.put(ID++, Materials.Bronze); + Material.invalidMaterials.put(ID++, Materials.Hydrogen); + //Infused TC stuff + Material.invalidMaterials.put(ID++, Materials.InfusedAir); + Material.invalidMaterials.put(ID++, Materials.InfusedEarth); + Material.invalidMaterials.put(ID++, Materials.InfusedFire); + Material.invalidMaterials.put(ID++, Materials.InfusedWater); + + //EIO Materials + Material.invalidMaterials.put(ID++, Materials.SoulSand); + Material.invalidMaterials.put(ID++, Materials.EnderPearl); + Material.invalidMaterials.put(ID++, Materials.EnderEye); + Material.invalidMaterials.put(ID++, Materials.Redstone); + Material.invalidMaterials.put(ID++, Materials.Glowstone); + Material.invalidMaterials.put(ID++, Materials.Soularium); + Material.invalidMaterials.put(ID++, Materials.PhasedIron); + + if (Material.invalidMaterials.size() > 0){ + return true; + } + return false; + + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 8d1d4e5ecd..84bd859ed4 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -589,7 +589,7 @@ public final class ALLOY { -1, //Boiling Point in C -1, -1, - true, //Uses Blast furnace? + false, //Uses Blast furnace? new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().TRINIUM_REFINED, 5), new MaterialStack(ELEMENT.getInstance().NAQUADAH, 9) diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 859ebd86cf..eccd283da9 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.material; import gregtech.api.enums.Materials; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.StringUtils; import gtPlusPlus.core.util.materials.MaterialUtils; @@ -10,7 +11,17 @@ public final class ELEMENT { private static final ELEMENT thisClass = new ELEMENT(); public ELEMENT(){ - + + //GTNH Trinium Handling + if (CORE.GTNH){ + TRINIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.valueOf("Trinium")); + TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material + } + else { + TRINIUM = new Material("Trinium", MaterialState.SOLID, new short[]{70, 110, 30}, 604, 4057, 181, 133, false, "Ke", 0, false);//Not a GT Inherited Material + TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material + } + } public static ELEMENT getInstance(){ @@ -131,7 +142,7 @@ public final class ELEMENT { //Fictional public final Material NAQUADAH = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadah); - public final Material TRINIUM = new Material("Trinium", MaterialState.SOLID, new short[]{170, 210, 130}, 604, 4057, 181, 133, false, "Ke", 0, false);//Not a GT Inherited Material - public final Material TRINIUM_REFINED = new Material("Refined Trinium", MaterialState.SOLID, new short[]{210, 255, 170}, 4304, 14057, 181, 133, false, "Ke", 0, new MaterialStack[]{new MaterialStack(TRINIUM, 1)});//Not a GT Inherited Material + public final Material TRINIUM; + public final Material TRINIUM_REFINED; //https://github.com/Blood-Asp/GT5-Unofficial/issues/609 } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 40d8461209..0b1139cbcf 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.material; import static gregtech.api.enums.GT_Values.M; -import java.util.ArrayList; +import java.util.*; import gregtech.api.enums.*; import gtPlusPlus.core.item.base.cell.BaseItemCell; @@ -28,7 +28,7 @@ public class Material { private final Fluid vMoltenFluid; private final Fluid vPlasma; - + private final boolean vGenerateCells; protected Object dataVar = MathUtils.generateSingularRandomHexValue(); @@ -60,10 +60,17 @@ public class Material { public final int vToolQuality; public final int vHarvestLevel; + + public static Map<Integer, Materials> invalidMaterials = new HashMap<Integer, Materials>(); + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final MaterialStack... inputs){ this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, inputs); } + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, boolean generateCells, final MaterialStack... inputs){ + this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, generateCells, inputs); + } + public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, final MaterialStack... inputs){ this(materialName, defaultState, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", radiationLevel, inputs); } @@ -83,7 +90,7 @@ public class Material { public Material(final String materialName, final MaterialState defaultState, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ this (materialName, defaultState, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, inputs); } - + public Material(final String materialName, final MaterialState defaultState, final long durability, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, final MaterialStack... inputs){ this.unlocalizedName = Utils.sanitizeString(materialName); @@ -105,7 +112,7 @@ public class Material { } } } - + //Set Melting/Boiling point, if value is -1 calculate it from compound inputs. if (meltingPoint != -1){ @@ -128,7 +135,7 @@ public class Material { this.meltingPointK = (int) MathUtils.celsiusToKelvin(this.meltingPointC); this.boilingPointK = (int) MathUtils.celsiusToKelvin(this.boilingPointC); - + //Set Proton/Neutron count, if value is -1 calculate it from compound inputs. if (protons != -1){ this.vProtons = protons; @@ -142,10 +149,10 @@ public class Material { else { this.vNeutrons = this.calculateNeutrons(); } - - - - + + + + this.vMass = this.getMass(); //Sets tool Durability @@ -247,12 +254,12 @@ public class Material { this.vChemicalFormula = "??"; } + final Materials isValid = Materials.get(this.getLocalizedName()); - if (FluidUtils.getFluidStack(localizedName, 1) != null){ this.vMoltenFluid = FluidUtils.getFluidStack(localizedName, 1).getFluid(); } - else if (isValid == Materials._NULL){ + else if (isValid == null || isValid == Materials._NULL){ this.vMoltenFluid = this.generateFluid(); } else { @@ -269,8 +276,6 @@ public class Material { this.vPlasma = this.generatePlasma(); - //dataVar = MathUtils.generateSingularRandomHexValue(); - String ratio = ""; if (this.vSmallestRatio != null) { for (int hu=0;hu<this.vSmallestRatio.length;hu++){ @@ -601,88 +606,151 @@ public class Material { public final Fluid generateFluid(){ - try { - if (Materials.get(this.localizedName) == Materials.Clay){ - return null; - } - } catch (final Throwable e){} - - if (Materials.get(this.localizedName).mFluid == null){ - Utils.LOG_WARNING("Generating our own fluid."); - - //Generate a Cell if we need to - if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ - if (this.vGenerateCells){ - final Item temp = new BaseItemCell(this); + final Materials isValid = Materials.get(this.getLocalizedName()); + Utils.LOG_WARNING("Is "+this.getLocalizedName()+" a Gregtech material? "+(isValid != null && isValid != Materials._NULL)+" | Found "+isValid.mDefaultLocalName); + if (isValid != Materials._NULL){ + for (Materials m : invalidMaterials.values()){ + if (isValid == m){ + Utils.LOG_WARNING("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){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. Fluid."); + return a1.getFluid(); + } + if (a2 != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. Gas."); + return a2.getFluid(); + } + if (a3 != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. Molten."); + return a3.getFluid(); + } + if (a4 != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. Solid."); + return a4.getFluid(); + } + if (a5 != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. Plasma."); + return a5.getFluid(); + } + Utils.LOG_WARNING("Using null."); + return null; } } + } - if (this.materialState == MaterialState.SOLID){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - "Molten "+this.getLocalizedName(), - this.RGBA, - this.materialState.ID(), - this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + if (this.materialState == MaterialState.SOLID){ + if (isValid.mFluid != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. mFluid."); + return isValid.mFluid; + } + else if (isValid.mStandardMoltenFluid != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); + return isValid.mStandardMoltenFluid; + } + } + else if (this.materialState == MaterialState.GAS){ + if (isValid.mGas != null){ + Utils.LOG_WARNING("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){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. mFluid."); + return isValid.mFluid; + } + else if (isValid.mGas != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. mGas."); + return isValid.mGas; } - else if (this.materialState == MaterialState.LIQUID){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - this.getLocalizedName(), - this.RGBA, - this.materialState.ID(), - this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + else if (isValid.mStandardMoltenFluid != null){ + Utils.LOG_WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); + return isValid.mStandardMoltenFluid; } - else if (this.materialState == MaterialState.GAS){ - return FluidUtils.addGTFluid( - this.getUnlocalizedName(), - this.getLocalizedName()+" Gas", - this.RGBA, - this.materialState.ID(), - this.getMeltingPointK(), - ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), - ItemList.Cell_Empty.get(1L, new Object[0]), - 1000); + } + + Utils.LOG_WARNING("Generating our own fluid."); + //Generate a Cell if we need to + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ + if (this.vGenerateCells){ + final Item temp = new BaseItemCell(this); + Utils.LOG_WARNING("Generated a cell for "+this.getUnlocalizedName()); } - else { //Plasma - return this.generatePlasma(); + else { + Utils.LOG_WARNING("Did not generate a cell for "+this.getUnlocalizedName()); } } - Utils.LOG_WARNING("Getting the fluid from a GT material instead."); - return Materials.get(this.localizedName).mFluid; + + if (this.materialState == MaterialState.SOLID){ + return FluidUtils.addGTFluid( + this.getUnlocalizedName(), + "Molten "+this.getLocalizedName(), + this.RGBA, + this.materialState.ID(), + this.getMeltingPointK(), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + else if (this.materialState == MaterialState.LIQUID){ + return FluidUtils.addGTFluid( + this.getUnlocalizedName(), + this.getLocalizedName(), + this.RGBA, + this.materialState.ID(), + this.getMeltingPointK(), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + else if (this.materialState == MaterialState.GAS){ + return FluidUtils.addGTFluid( + this.getUnlocalizedName(), + this.getLocalizedName()+" Gas", + this.RGBA, + this.materialState.ID(), + this.getMeltingPointK(), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1), + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + else { //Plasma + return this.generatePlasma(); + } } public final Fluid generatePlasma(){ - final Materials isValid = Materials.get(this.getLocalizedName()); - if ((isValid != Materials._NULL) && (isValid != null) && (isValid != Materials.Clay) && (isValid != Materials.Clay) - && (isValid != Materials.Phosphorus) && (isValid != Materials.Steel) && (isValid != Materials.Bronze)){ - if (isValid.mPlasma != null){ - Utils.LOG_WARNING("Using a pre-defined Plasma from GT."); - return isValid.mPlasma; - } - } - - if (this.vGenerateCells){ + final Materials isValid = Materials.get(this.getLocalizedName()); + + if (!this.vGenerateCells){ return null; } - + for (Materials m : invalidMaterials.values()){ + if (isValid == m){ + return (m.mPlasma != null ? m.mPlasma : null); + } + } + if (isValid.mPlasma != null){ + Utils.LOG_WARNING("Using a pre-defined Plasma from GT."); + return isValid.mPlasma; + } + Utils.LOG_WARNING("Generating our own Plasma."); return FluidUtils.addGTPlasma(this); - //return null; } - final public FluidStack getFluid(final int fluidAmount) { - //Utils.LOG_WARNING("Attempting to get "+fluidAmount+"L of "+this.vMoltenFluid.getName()); + final public FluidStack getFluid(final int fluidAmount) { + if (this.vMoltenFluid == null){ + return null; + } final FluidStack moltenFluid = new FluidStack(this.vMoltenFluid, fluidAmount); - //Utils.LOG_WARNING("Info: "+moltenFluid.getFluid().getName()+" Info: "+moltenFluid.amount+" Info: "+moltenFluid.getFluidID()); return moltenFluid; } diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 65c0f1e6c0..f252b0d54e 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -19,15 +19,7 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_AlloySmelter; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Assembler; -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_Fluids; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting; +import gtPlusPlus.xmod.gregtech.loaders.*; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -148,7 +140,7 @@ public class MaterialGenerator { return true; } catch (final Throwable t) { - Utils.LOG_INFO(""+matInfo.getLocalizedName()+" failed to generate."); + Utils.LOG_WARNING(""+matInfo.getLocalizedName()+" failed to generate."); return false; } } @@ -219,7 +211,7 @@ public class MaterialGenerator { RecipeGen_DustGeneration.generateRecipes(matInfo, true); new RecipeGen_Recycling(matInfo); } catch (final Throwable t){ - Utils.LOG_INFO(""+matInfo.getLocalizedName()+" failed to generate."); + Utils.LOG_WARNING(""+matInfo.getLocalizedName()+" failed to generate."); } } diff --git a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java index c6043a1b3d..5f83074a0d 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java @@ -19,6 +19,7 @@ public class FLUORIDES { ((ELEMENT.getInstance().CALCIUM.getProtons()+(ELEMENT.getInstance().FLUORINE.getProtons()*2))/3), //Protons ((ELEMENT.getInstance().CALCIUM.getNeutrons()+(ELEMENT.getInstance().FLUORINE.getNeutrons()*2))/3), //Neutrons false, //Uses Blast furnace? + false, //Generate cells //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 1), diff --git a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java index f6c7d952b8..ea21a1d270 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/NUCLIDE.java @@ -13,18 +13,16 @@ public final class NUCLIDE { public static NUCLIDE getInstance(){return thisClass;} //Custom Isotopes - public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.LIQUID, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0);//Not a GT Inherited Material + public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.LIQUID, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0, false);//Not a GT Inherited Material public final Material URANIUM232 = new Material("Uranium 232", MaterialState.SOLID, new short[]{88, 220, 103, 0}, 1132, 4131, 92, 140, false, StringUtils.superscript("232U"), 4);//Not a GT Inherited Material public final Material URANIUM233 = new Material("Uranium 233", MaterialState.SOLID, new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, StringUtils.superscript("233U"), 2);//Not a GT Inherited Material - public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1);//Not a GT Inherited Material + public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1, false);//Not a GT Inherited Material //RTG Fuels - public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, StringUtils.superscript("238Pu"), 2);//Not a GT Inherited Material - public final Material STRONTIUM90 = new Material("Strontium-90", MaterialState.SOLID, Materials.Strontium.mDurability, Materials.Strontium.mRGBa, Materials.Strontium.mMeltingPoint, Materials.Strontium.mBlastFurnaceTemp, 38, 52, false, StringUtils.superscript("90Sr"), 2);//Not a GT Inherited Material - public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, ELEMENT.getInstance().POLONIUM.vDurability, ELEMENT.getInstance().POLONIUM.getRGBA(), ELEMENT.getInstance().POLONIUM.getMeltingPointK(), ELEMENT.getInstance().POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2);//Not a GT Inherited Material - public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2);//Not a GT Inherited Material - - + public final Material PLUTONIUM238 = new Material("Plutonium-238", MaterialState.SOLID, Materials.Plutonium241.mDurability, Materials.Plutonium241.mRGBa, Materials.Plutonium241.mMeltingPoint, Materials.Plutonium241.mBlastFurnaceTemp, 94, 144, false, StringUtils.superscript("238Pu"), 2, false);//Not a GT Inherited Material + public final Material STRONTIUM90 = new Material("Strontium-90", MaterialState.SOLID, Materials.Strontium.mDurability, Materials.Strontium.mRGBa, Materials.Strontium.mMeltingPoint, Materials.Strontium.mBlastFurnaceTemp, 38, 52, false, StringUtils.superscript("90Sr"), 2, false);//Not a GT Inherited Material + public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, ELEMENT.getInstance().POLONIUM.vDurability, ELEMENT.getInstance().POLONIUM.getRGBA(), ELEMENT.getInstance().POLONIUM.getMeltingPointK(), ELEMENT.getInstance().POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2, false);//Not a GT Inherited Material + public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2, false);//Not a GT Inherited Material public static final Material LiFBeF2ThF4UF4 = new Material( "LiFBeF2ThF4UF4", //Material Name diff --git a/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java b/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java index 018e0bee82..b6f6dfccdc 100644 --- a/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java +++ b/src/Java/gtPlusPlus/preloader/Preloader_GT_OreDict.java @@ -48,7 +48,7 @@ public class Preloader_GT_OreDict { } //Mekanism Support - Let's not make Mek Osmium useful in GT anymore. - if ((((bannedItem != null) && (ItemUtils.getModId(bannedItem).toLowerCase().equals("mekanism"))) || (LoadedMods.Mekanism)) && !LoadedMods.RedTech){ + if ((((bannedItem != null) && !LoadedMods.RedTech && (ItemUtils.getModId(bannedItem).toLowerCase().equals("mekanism"))) || (LoadedMods.Mekanism)) && !LoadedMods.RedTech){ //Circuits if (Class.forName("mekanism.common.item.ItemControlCircuit") != null) { final Class<?> MekCircuit = Class.forName("mekanism.common.item.ItemControlCircuit"); diff --git a/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java b/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java index cdb04c9b45..a8c5382a21 100644 --- a/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java +++ b/src/Java/gtPlusPlus/xmod/eio/material/MaterialEIO.java @@ -1,10 +1,6 @@ package gtPlusPlus.xmod.eio.material; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.NONMATERIAL; +import gtPlusPlus.core.material.*; import gtPlusPlus.core.material.state.MaterialState; public class MaterialEIO { @@ -18,6 +14,7 @@ public class MaterialEIO { 10, 10, false, //Uses Blast furnace? + false, //Generates a cell //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().GOLD, 1), @@ -33,6 +30,7 @@ public class MaterialEIO { 10, 10, false, //Uses Blast furnace? + false, //Generates a cell //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().IRON, 1), @@ -48,6 +46,7 @@ public class MaterialEIO { 10, 10, false, //Uses Blast furnace? + false, //Generates a cell //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().IRON, 1), @@ -63,6 +62,7 @@ public class MaterialEIO { 10, 10, false, //Uses Blast furnace? + false, //Generates a cell //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ALLOY.STEEL, 3), @@ -78,6 +78,7 @@ public class MaterialEIO { 10, 10, false, //Uses Blast furnace? + false, //Generates a cell //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().GOLD, 1), @@ -94,6 +95,7 @@ public class MaterialEIO { 10, 10, false, //Uses Blast furnace? + false, //Generates a cell //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ENERGETIC_ALLOY, 1), @@ -109,6 +111,7 @@ public class MaterialEIO { 10, 10, false, //Uses Blast furnace? + false, //Generates a cell //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().SILICON, 1), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index 46bf36c445..b7af6eadac 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -114,12 +114,12 @@ public class RecipeGen_DustGeneration implements Runnable{ //Is this a composite? if ((inputStacks != null) && !disableOptional){ //Is this a composite? - Utils.LOG_INFO("mixer length: "+inputStacks.length); + Utils.LOG_WARNING("mixer length: "+inputStacks.length); if ((inputStacks.length != 0) && (inputStacks.length <= 4)){ //Log Input items Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); final long[] inputStackSize = material.vSmallestRatio; - Utils.LOG_INFO("mixer is stacksizeVar null? "+(inputStackSize != null)); + Utils.LOG_WARNING("mixer is stacksizeVar null? "+(inputStackSize != null)); //Is smallest ratio invalid? if (inputStackSize != null){ //set stack sizes on an input ItemStack[] @@ -168,19 +168,19 @@ public class RecipeGen_DustGeneration implements Runnable{ (int) Math.max(material.getMass() * 2L * 1, 1), 2 * material.vVoltageMultiplier)) //Was 6, but let's try 2. This makes Potin LV, for example. { - Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Success"); + Utils.LOG_WARNING("Dust Mixer Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); } //Add Shapeless recipe for low tier alloys. if (tVoltageMultiplier <= 30){ if (RecipeUtils.addShapedGregtechRecipe(inputStacks, outputStacks)){ - Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Success"); + Utils.LOG_WARNING("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Success"); } else { - Utils.LOG_INFO("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Dust Shapeless Recipe: "+material.getLocalizedName()+" - Failed"); } } } @@ -200,12 +200,12 @@ public class RecipeGen_DustGeneration implements Runnable{ //Is this a composite? if ((inputStacks != null)){ //Is this a composite? - Utils.LOG_INFO("mixer length: "+inputStacks.length); + Utils.LOG_WARNING("mixer length: "+inputStacks.length); if ((inputStacks.length >= 1) && (inputStacks.length <= 4)){ //Log Input items Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); final long[] inputStackSize = material.vSmallestRatio; - Utils.LOG_INFO("mixer is stacksizeVar not null? "+(inputStackSize != null)); + Utils.LOG_WARNING("mixer is stacksizeVar not null? "+(inputStackSize != null)); //Is smallest ratio invalid? if (inputStackSize != null){ //set stack sizes on an input ItemStack[] @@ -215,7 +215,7 @@ public class RecipeGen_DustGeneration implements Runnable{ } } //Relog input values, with stack sizes - Utils.LOG_INFO(ItemUtils.getArrayStackNames(inputStacks)); + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(inputStacks)); //Get us four ItemStacks to input into the mixer ItemStack input1, input2, input3, input4; @@ -254,24 +254,24 @@ public class RecipeGen_DustGeneration implements Runnable{ (int) Math.max(material.getMass() * 2L * 1, 1), 2 * material.vVoltageMultiplier)) //Was 6, but let's try 2. This makes Potin LV, for example. { - Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Success"); + Utils.LOG_WARNING("Dust Mixer Recipe: "+material.getLocalizedName()+" - Success"); return true; } else { - Utils.LOG_INFO("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); + Utils.LOG_WARNING("Dust Mixer Recipe: "+material.getLocalizedName()+" - Failed"); return false; } } else { - Utils.LOG_INFO("inputStackSize == NUll - "+material.getLocalizedName()); + Utils.LOG_WARNING("inputStackSize == NUll - "+material.getLocalizedName()); } } else { - Utils.LOG_INFO("InputStacks is out range 1-4 - "+material.getLocalizedName()); + Utils.LOG_WARNING("InputStacks is out range 1-4 - "+material.getLocalizedName()); } } else { - Utils.LOG_INFO("InputStacks == NUll - "+material.getLocalizedName()); + Utils.LOG_WARNING("InputStacks == NUll - "+material.getLocalizedName()); } return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java index d0651f783c..f48d9822f0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -9,10 +9,7 @@ import org.apache.commons.lang3.reflect.FieldUtils; import gregtech.api.enums.GT_Values; import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.item.ModItems; +import gregtech.api.util.*; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; @@ -20,7 +17,6 @@ import gtPlusPlus.core.util.array.Pair; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; public class RecipeGen_Recycling implements Runnable { @@ -51,21 +47,59 @@ public class RecipeGen_Recycling implements Runnable { OrePrefixes.plate, OrePrefixes.plateDense, OrePrefixes.plateDouble, OrePrefixes.plateTriple, OrePrefixes.plateQuadruple, OrePrefixes.plateQuintuple, OrePrefixes.stick, OrePrefixes.stickLong, OrePrefixes.bolt, OrePrefixes.screw, OrePrefixes.ring, OrePrefixes.rotor, OrePrefixes.gearGt, - OrePrefixes.gearGtSmall }; + OrePrefixes.gearGtSmall, OrePrefixes.gear, OrePrefixes.block, OrePrefixes.cableGt01, OrePrefixes.cableGt02, + OrePrefixes.cableGt04, OrePrefixes.cableGt08, OrePrefixes.cableGt12, OrePrefixes.wireFine, OrePrefixes.wireGt01, + OrePrefixes.wireGt02, OrePrefixes.wireGt04, OrePrefixes.wireGt08, OrePrefixes.wireGt12, OrePrefixes.wireGt16, + OrePrefixes.foil, OrePrefixes.frameGt, OrePrefixes.pipeHuge, OrePrefixes.pipeLarge, OrePrefixes.pipeMedium, OrePrefixes.pipeSmall, OrePrefixes.pipeTiny, + }; - Utils.LOG_INFO("Found " + mValidPrefixesAsString.length + " valid OreDict prefixes."); + int mSlotIndex = 0; + Pair<OrePrefixes, ItemStack>[] mValidPairs = new Pair[mValidPrefixesAsString.length]; + + for (int r=0;r<mValidPairs.length;r++){ + ItemStack temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(mValidPrefixesAsString[r].name()+Utils.sanitizeString(material.getLocalizedName()), 1); + if (temp != null){ + mValidPairs[mSlotIndex++] = new Pair<OrePrefixes, ItemStack>(mValidPrefixesAsString[r], temp.copy()); + } + else { + Utils.LOG_INFO("Invalid Item: "+mValidPrefixesAsString[r].name()+Utils.sanitizeString(material.getLocalizedName())); + } + } + + if (mValidPairs.length > 0){ + int validCounter = 0; + Pair<OrePrefixes, ItemStack>[] temp = mValidPairs; + for (Pair<OrePrefixes, ItemStack> temp2 : mValidPairs){ + if (temp2 != null){ + Utils.LOG_INFO("Valid: "+temp2.getValue().getDisplayName()); + validCounter++; + } + } + Pair<OrePrefixes, ItemStack> temp3[] = new Pair[validCounter]; + int temp4 = 0; + for (Pair<OrePrefixes, ItemStack> r : mValidPairs){ + if (r != null){ + temp3[temp4++] = r; + } + } + if (temp3.length > 0){ + mValidPairs = temp3.clone(); + } + } + + Utils.LOG_INFO("Found " + mValidPairs.length + " valid OreDict prefixes."); if (mValidPrefixesAsString.length >= 1) { - for (final OrePrefixes validPrefix : mValidPrefixesAsString) { + for (final Pair<OrePrefixes, ItemStack> validPrefix : mValidPairs) { try { if (material.getState() != MaterialState.SOLID){ continue; } - final ItemStack tempStack = get(validPrefix, material, 1); - final ItemStack mDust = getDust(material, validPrefix); - final Pair<OrePrefixes, ItemStack> mData = getDustData(material, validPrefix); - int mFluidAmount = (int) GT_Utility.translateMaterialToFluidAmount(mData.getKey().mMaterialAmount, true); + final ItemStack tempStack = validPrefix.getValue(); + final ItemStack mDust = getDust(material, validPrefix.getKey()); + final Pair<OrePrefixes, ItemStack> mData = getDustData(material, validPrefix.getKey()); + int mFluidAmount = (int) GT_Utility.translateMaterialToFluidAmount(validPrefix.getKey().mMaterialAmount, true); //Maceration if (tempStack != null) { @@ -91,11 +125,11 @@ public class RecipeGen_Recycling implements Runnable { if (tempStack != null) { // mValidItems[mSlotIndex++] = tempStack; if ((mDust != null) && GT_Values.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 0, 30, 8)) { - Utils.LOG_INFO("Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " - + tempStack.getDisplayName() + " and obtain " + mDust.getDisplayName()); + Utils.LOG_INFO("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " + + tempStack.getDisplayName() + " and obtain " + mFluidAmount+"mb of "+material.getFluid(1).getLocalizedName()+"."); } else { - Utils.LOG_INFO("Recycle Recipe: " + material.getLocalizedName() + " - Failed"); + Utils.LOG_INFO("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Failed"); if (mDust == null) { Utils.LOG_INFO("Invalid Dust output."); } |