diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-24 23:14:48 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-24 23:14:48 +1000 |
commit | 38bb9a07d82a0161107084436b7390f877bfd353 (patch) | |
tree | 4de0b7bc29ac24353f2ba24edc6ddbb1ff9c267e /src/Java/gtPlusPlus/core/material | |
parent | 2b9da4a0f048300e14bf359b705a4c04c05064ba (diff) | |
download | GT5-Unofficial-38bb9a07d82a0161107084436b7390f877bfd353.tar.gz GT5-Unofficial-38bb9a07d82a0161107084436b7390f877bfd353.tar.bz2 GT5-Unofficial-38bb9a07d82a0161107084436b7390f877bfd353.zip |
+ More Ore Work.
Diffstat (limited to 'src/Java/gtPlusPlus/core/material')
-rw-r--r-- | src/Java/gtPlusPlus/core/material/Material.java | 156 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/material/MaterialGenerator.java | 53 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/material/MaterialStack.java | 1 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/material/ORES.java | 38 |
4 files changed, 167 insertions, 81 deletions
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index c8637f5aeb..1ebd335031 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -22,44 +22,44 @@ import net.minecraftforge.fluids.FluidStack; public class Material { - private final String unlocalizedName; - private final String localizedName; + private String unlocalizedName; + private String localizedName; - private final MaterialState materialState; + private MaterialState materialState; - private final Fluid vMoltenFluid; - private final Fluid vPlasma; + private Fluid vMoltenFluid; + private Fluid vPlasma; - private final boolean vGenerateCells; + private boolean vGenerateCells; protected Object dataVar = MathUtils.generateSingularRandomHexValue(); private ArrayList<MaterialStack> vMaterialInput = new ArrayList<>(); - public final long[] vSmallestRatio; - public final short vComponentCount; + public long[] vSmallestRatio; + public short vComponentCount; - private final short[] RGBA; + private short[] RGBA; - private final boolean usesBlastFurnace; - public final boolean isRadioactive; - public final byte vRadiationLevel; + private boolean usesBlastFurnace; + public boolean isRadioactive; + public byte vRadiationLevel; - private final int meltingPointK; - private final int boilingPointK; - private final int meltingPointC; - private final int boilingPointC; - private final long vProtons; - private final long vNeutrons; - private final long vMass; - public final int smallestStackSizeWhenProcessing; //Add a check for <=0 || > 64 - public final int vTier; - public final int vVoltageMultiplier; - public final String vChemicalFormula; - public final String vChemicalSymbol; + private int meltingPointK; + private int boilingPointK; + private int meltingPointC; + private int boilingPointC; + private long vProtons; + private long vNeutrons; + private long vMass; + public int smallestStackSizeWhenProcessing; //Add a check for <=0 || > 64 + public int vTier; + public int vVoltageMultiplier; + public String vChemicalFormula; + public String vChemicalSymbol; - public final long vDurability; - public final int vToolQuality; - public final int vHarvestLevel; + public long vDurability; + public int vToolQuality; + public int vHarvestLevel; public static Map<Integer, Materials> invalidMaterials = new HashMap<Integer, Materials>(); @@ -68,6 +68,10 @@ public class Material { this (materialName, defaultState, 0, rgba, -1, -1, -1, -1, false, "", radiationLevel, false, materialStacks); } + public Material(String materialName, MaterialState defaultState, short[] rgba, int radiationLevel, int j, int k, int l, int m, MaterialStack[] materialStacks){ + this (materialName, defaultState, 0, rgba, j, k, l, m, false, "", radiationLevel, false, materialStacks); + } + 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); } @@ -97,7 +101,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, boolean generateCells, final MaterialStack... inputs){ - + try { this.unlocalizedName = Utils.sanitizeString(materialName); this.localizedName = materialName; this.materialState = defaultState; @@ -251,11 +255,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.INFO("materialInput is null, using a valid chemical symbol."); this.vChemicalFormula = this.vChemicalSymbol; } else{ - Logger.WARNING("MaterialInput == null && chemicalSymbol probably equals nothing"); + Logger.INFO("MaterialInput == null && chemicalSymbol probably equals nothing"); this.vChemicalFormula = "??"; } @@ -293,15 +297,21 @@ 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.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."); + } + catch (Throwable t){ + t.printStackTrace(); + } } + + public final String getLocalizedName(){ if (this.localizedName != null) { return this.localizedName; @@ -453,21 +463,21 @@ public class Material { if (!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_INFO("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.INFO("Failed gathering material stack for "+this.localizedName+"."); + Logger.INFO("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); } try { if (testNull != null){ - //Utils.LOG_WARNING("not null"); + //Utils.LOG_INFO("not null"); temp[i] = this.vMaterialInput.get(i).getValidStack(); } } catch (final Throwable r){ - Logger.WARNING("Failed setting slot "+i+", using "+this.localizedName); + Logger.INFO("Failed setting slot "+i+", using "+this.localizedName); } } return temp; @@ -515,9 +525,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.INFO("length: "+tempInput.size()); + Logger.INFO("(inputs != null): "+(tempInput != null)); + //Utils.LOG_INFO("length: "+inputs.length); final long[] tempRatio = new long[tempInput.size()]; for (int x=0;x<tempInput.size();x++){ //tempPercentage = tempPercentage+inputs[x].percentageToUse; @@ -534,7 +544,7 @@ public class Material { for (int r=0;r<tempRatio.length;r++){ tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] +" : "; } - Logger.WARNING("Default Ratio: "+tempRatioStringThing1); + Logger.INFO("Default Ratio: "+tempRatioStringThing1); String tempRatioStringThing = ""; int tempSmallestCraftingUseSize = 0; @@ -543,7 +553,7 @@ public class Material { tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]); } //this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize; - Logger.WARNING("Smallest Ratio: "+tempRatioStringThing); + Logger.INFO("Smallest Ratio: "+tempRatioStringThing); return smallestRatio; } } @@ -555,7 +565,7 @@ public class Material { if (!aShowQuestionMarks && (this.vChemicalFormula.equals("?")||this.vChemicalFormula.equals("??"))) { return ""; } - Logger.WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); + Logger.INFO("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); if (!chemSymbol.equals("")) { return chemSymbol; } @@ -598,13 +608,13 @@ public class Material { return StringUtils.subscript(dummyFormula); //return dummyFormula; } - Logger.WARNING("dummyFormulaArray <= 0"); + Logger.INFO("dummyFormulaArray <= 0"); } - Logger.WARNING("dummyFormulaArray == null"); + Logger.INFO("dummyFormulaArray == null"); } - Logger.WARNING("tempInput.length <= 0"); + Logger.INFO("tempInput.length <= 0"); } - Logger.WARNING("tempInput == null"); + Logger.INFO("tempInput == null"); return "??"; } @@ -612,37 +622,37 @@ public class Material { public final Fluid generateFluid(){ final Materials isValid = Materials.get(this.getLocalizedName()); - Logger.WARNING("Is "+this.getLocalizedName()+" a Gregtech material? "+(isValid != null && isValid != Materials._NULL)+" | Found "+isValid.mDefaultLocalName); + Logger.INFO("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){ - Logger.WARNING("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName); + Logger.INFO("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.INFO("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.INFO("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.INFO("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.INFO("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.INFO("Using a pre-defined Fluid from GT. Plasma."); return a5.getFluid(); } - Logger.WARNING("Using null."); + Logger.INFO("Using null."); return null; } } @@ -650,44 +660,44 @@ public class Material { if (this.materialState == MaterialState.SOLID){ if (isValid.mFluid != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. mFluid."); + Logger.INFO("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.INFO("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.INFO("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.INFO("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.INFO("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.INFO("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); return isValid.mStandardMoltenFluid; } } - Logger.WARNING("Generating our own fluid."); + Logger.INFO("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); - Logger.WARNING("Generated a cell for "+this.getUnlocalizedName()); + Logger.INFO("Generated a cell for "+this.getUnlocalizedName()); } else { - Logger.WARNING("Did not generate a cell for "+this.getUnlocalizedName()); + Logger.INFO("Did not generate a cell for "+this.getUnlocalizedName()); } } @@ -741,11 +751,11 @@ public class Material { } } if (isValid.mPlasma != null){ - Logger.WARNING("Using a pre-defined Plasma from GT."); + Logger.INFO("Using a pre-defined Plasma from GT."); return isValid.mPlasma; } - Logger.WARNING("Generating our own Plasma."); + Logger.INFO("Generating our own Plasma."); return FluidUtils.addGTPlasma(this); } @@ -767,14 +777,14 @@ public class Material { if (part != null){ int incrementor = part.getStackMaterial().getMeltingPointC(); meltingPoint += incrementor; - Logger.WARNING("Melting Point for "+this.getLocalizedName()+" increased to "+ incrementor); + Logger.INFO("Melting Point for "+this.getLocalizedName()+" increased to "+ 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."); + Logger.INFO("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); meltingPoint = (meltingPoint/divisor); return meltingPoint; } diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 727f929036..33bddd3a4f 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -3,13 +3,18 @@ package gtPlusPlus.core.material; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; import gtPlusPlus.core.block.base.BlockBaseModular; +import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.item.base.bolts.BaseItemBolt; import gtPlusPlus.core.item.base.dusts.BaseItemDust; import gtPlusPlus.core.item.base.gears.BaseItemGear; import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; import gtPlusPlus.core.item.base.nugget.BaseItemNugget; +import gtPlusPlus.core.item.base.ore.BaseItemCentrifugedCrushedOre; import gtPlusPlus.core.item.base.ore.BaseItemCrushedOre; +import gtPlusPlus.core.item.base.ore.BaseItemImpureDust; +import gtPlusPlus.core.item.base.ore.BaseItemPurifiedCrushedOre; +import gtPlusPlus.core.item.base.ore.BaseItemPurifiedDust; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; import gtPlusPlus.core.item.base.rings.BaseItemRing; @@ -130,7 +135,9 @@ public class MaterialGenerator { if (sRadiation >= 1){ Item temp; Block tempBlock; - tempBlock = new BlockBaseModular(matInfo ,BlockTypes.ORE, Colour); + //tempBlock = new BlockBaseModular(matInfo ,BlockTypes.ORE, Colour); + tempBlock = new BlockBaseOre(matInfo ,BlockTypes.ORE, Colour); + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); @@ -230,6 +237,50 @@ public class MaterialGenerator { Logger.WARNING(""+matInfo.getLocalizedName()+" failed to generate."); } } + + + public static void generateOreMaterial(final Material matInfo){ + generateOreMaterial(matInfo, true); + } + + @SuppressWarnings("unused") + public static void generateOreMaterial(final Material matInfo, final boolean generatePlates){ + try { + final String unlocalizedName = matInfo.getUnlocalizedName(); + final String materialName = matInfo.getLocalizedName(); + final short[] C = matInfo.getRGBA(); + final int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); + + int sRadiation = 0; + if (matInfo.vRadiationLevel != 0){ + sRadiation = matInfo.vRadiationLevel; + } + + Item temp; + Block tempBlock; + + tempBlock = new BlockBaseOre(matInfo ,BlockTypes.ORE, Colour); + + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", matInfo.vTier, sRadiation); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", matInfo.vTier, sRadiation); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", matInfo.vTier, sRadiation); + temp = new BaseItemCrushedOre(matInfo); + temp = new BaseItemCentrifugedCrushedOre(matInfo); + temp = new BaseItemPurifiedCrushedOre(matInfo); + temp = new BaseItemImpureDust(matInfo); + temp = new BaseItemPurifiedDust(matInfo); + + RecipeGen_Plates.generateRecipes(matInfo); + RecipeGen_Extruder.generateRecipes(matInfo); + RecipeGen_ShapedCrafting.generateRecipes(matInfo); + RecipeGen_Fluids.generateRecipes(matInfo); + RecipeGen_Assembler.generateRecipes(matInfo); + RecipeGen_DustGeneration.generateRecipes(matInfo, true); + new RecipeGen_Recycling(matInfo); + } catch (final Throwable t){ + Logger.WARNING(""+matInfo.getLocalizedName()+" failed to generate."); + } + } } diff --git a/src/Java/gtPlusPlus/core/material/MaterialStack.java b/src/Java/gtPlusPlus/core/material/MaterialStack.java index ad7af2052f..b0d37ac2d4 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialStack.java +++ b/src/Java/gtPlusPlus/core/material/MaterialStack.java @@ -16,6 +16,7 @@ public class MaterialStack { public MaterialStack(final Material inputs, final double partOutOf100){ this.stackMaterial = inputs; + //Logger.INFO("Tried getting MaterialStack for "+inputs.getLocalizedName()); this.vPercentageToUse = partOutOf100; this.vAmount = this.math(partOutOf100); } diff --git a/src/Java/gtPlusPlus/core/material/ORES.java b/src/Java/gtPlusPlus/core/material/ORES.java index 4057092a48..346934060f 100644 --- a/src/Java/gtPlusPlus/core/material/ORES.java +++ b/src/Java/gtPlusPlus/core/material/ORES.java @@ -6,8 +6,12 @@ public final class ORES { public static final Material GEIKIELITE = new Material( "Geikielite", //Material Name - MaterialState.ORE, //State + MaterialState.SOLID, //State new short[]{187, 193, 204, 0}, //Material Colour + 500, + 1500, + 50, + 75, 0, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().MAGNESIUM, 1), @@ -17,11 +21,15 @@ public final class ORES { public static final Material ZIMBABWEITE = new Material( "Zimbabweite", //Material Name - MaterialState.ORE, //State + MaterialState.SOLID, //State new short[]{193, 187, 131, 0}, //Material Colour + 500, + 1500, + 50, + 75, 0, //Radiation new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SODIUM, 2), + new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), new MaterialStack(ELEMENT.getInstance().POTASSIUM, 2), new MaterialStack(ELEMENT.getInstance().LEAD, 1), new MaterialStack(ELEMENT.getInstance().ARSENIC, 4), @@ -33,8 +41,12 @@ public final class ORES { public static final Material TITANITE = new Material( "Titanite", //Material Name - MaterialState.ORE, //State + MaterialState.SOLID, //State new short[]{184, 198, 105, 0}, //Material Colour + 500, + 1500, + 50, + 75, 0, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), @@ -46,8 +58,12 @@ public final class ORES { public static final Material ZIRCONILITE = new Material( "Zirconolite", //Material Name - MaterialState.ORE, //State + MaterialState.SOLID, //State new short[]{45, 26, 0, 0}, //Material Colour + 500, + 1500, + 50, + 75, 0, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().CALCIUM, 2), @@ -59,8 +75,12 @@ public final class ORES { public static final Material CROCROITE = new Material( "Crocoite", //Material Name - MaterialState.ORE, //State + MaterialState.SOLID, //State new short[]{255, 143, 84, 0}, //Material Colour + 500, + 1500, + 50, + 75, 0, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().LEAD, 1), @@ -70,8 +90,12 @@ public final class ORES { public static final Material NICHROMITE = new Material( "Nichromite", //Material Name - MaterialState.ORE, //State + MaterialState.SOLID, //State new short[]{22, 19, 19, 0}, //Material Colour + 500, + 1500, + 50, + 75, 0, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().NICKEL, 1), |