initMaterialProperties

This commit is contained in:
Muramasa 2016-08-19 12:15:05 +01:00
parent eaadf6f74b
commit 46daf120bb
14 changed files with 134 additions and 65 deletions

View file

@ -28,6 +28,10 @@ version = "${config.gt.version}"
group= "gregtech" group= "gregtech"
archivesBaseName = "gregtech" archivesBaseName = "gregtech"
sourceCompatibility = 1.7
targetCompatibility = 1.7
minecraft { minecraft {
version = "${config.minecraft.version}-${config.forge.version}" version = "${config.minecraft.version}-${config.forge.version}"
runDir = "eclipse" runDir = "eclipse"

View file

@ -245,7 +245,7 @@ public class GT_Mod
if(gregtechproxy.mChangeHarvestLevels){ if(gregtechproxy.mChangeHarvestLevels){
gregtechproxy.mGraniteHavestLevel = (int) GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3); gregtechproxy.mGraniteHavestLevel = (int) GregTech_API.sMaterialProperties.get("havestLevel", "graniteHarvestLevel", 3);
gregtechproxy.mMaxHarvestLevel=(int) Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel",7)); gregtechproxy.mMaxHarvestLevel=(int) Math.min(15, GregTech_API.sMaterialProperties.get("havestLevel", "maxLevel",7));
for(Materials tMaterial : Materials.VALUES){ for(Materials tMaterial : Materials.MATERIALS.values()){
if(tMaterial!=null&&tMaterial.mToolQuality>0&&tMaterial.mMetaItemSubID<gregtechproxy.mHarvestLevel.length&&tMaterial.mMetaItemSubID>=0){ if(tMaterial!=null&&tMaterial.mToolQuality>0&&tMaterial.mMetaItemSubID<gregtechproxy.mHarvestLevel.length&&tMaterial.mMetaItemSubID>=0){
gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName,tMaterial.mToolQuality); gregtechproxy.mHarvestLevel[tMaterial.mMetaItemSubID] = GregTech_API.sMaterialProperties.get("materialHavestLevel", tMaterial.mDefaultLocalName,tMaterial.mToolQuality);
} }
@ -269,7 +269,11 @@ public class GT_Mod
} }
} }
//GT_Config.troll = (Calendar.getInstance().get(2) + 1 == 4) && (Calendar.getInstance().get(5) >= 1) && (Calendar.getInstance().get(5) <= 2); //GT_Config.troll = (Calendar.getInstance().get(2) + 1 == 4) && (Calendar.getInstance().get(5) >= 1) && (Calendar.getInstance().get(5) <= 2);
Materials Muranium = new Materials(378, TextureSet.SET_NONE, 1.0F, 0, 2, 1|2|4|8|16|32|64|128, 92, 0, 168, 0, "Muranium", 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL, "takpak");
//SubTag.METAL.addTo(Muranium);
Materials.initCustomMaterials(); Materials.initCustomMaterials();
Materials.initMaterialProperties();
Materials.initGeneratedMaterials();
GT_Log.out.println("GT_Mod: Saving Main Config"); GT_Log.out.println("GT_Mod: Saving Main Config");
tMainConfig.save(); tMainConfig.save();
@ -387,7 +391,7 @@ public class GT_Mod
} }
new GT_Bees(); new GT_Bees();
gregtechproxy.onLoad(); gregtechproxy.onLoad();
if (gregtechproxy.mSortToTheEnd) { if (gregtechproxy.mSortToTheEnd) {
new GT_ItemIterator().run(); new GT_ItemIterator().run();
@ -642,7 +646,7 @@ public class GT_Mod
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Orb to overwrite", new Object[0])}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Copy of the Orb", new Object[0])}, ItemList.Tool_DataOrb.getWithName(0L, "Orb to copy", new Object[0]), null, null, 512, 32, 0); GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Orb to overwrite", new Object[0])}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Copy of the Orb", new Object[0])}, ItemList.Tool_DataOrb.getWithName(0L, "Orb to copy", new Object[0]), null, null, 512, 32, 0);
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Stick to overwrite", new Object[0])}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Copy of the Stick", new Object[0])}, ItemList.Tool_DataStick.getWithName(0L, "Stick to copy", new Object[0]), null, null, 128, 32, 0); GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Stick to overwrite", new Object[0])}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Copy of the Stick", new Object[0])}, ItemList.Tool_DataStick.getWithName(0L, "Stick to copy", new Object[0]), null, null, 128, 32, 0);
GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Raw Prospection Data", new Object[0])}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Analyzed Prospection Data", new Object[0])}, null, null, null, 1000, 32, 0); GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Raw Prospection Data", new Object[0])}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Analyzed Prospection Data", new Object[0])}, null, null, null, 1000, 32, 0);
for (Materials tMaterial : Materials.VALUES) { for (Materials tMaterial : Materials.MATERIALS.values()) {
if ((tMaterial.mElement != null) && (!tMaterial.mElement.mIsIsotope) && (tMaterial != Materials.Magic) && (tMaterial.getMass() > 0L)) { if ((tMaterial.mElement != null) && (!tMaterial.mElement.mIsIsotope) && (tMaterial != Materials.Magic) && (tMaterial.getMass() > 0L)) {
ItemStack tOutput = ItemList.Tool_DataOrb.get(1L, new Object[0]); ItemStack tOutput = ItemList.Tool_DataOrb.get(1L, new Object[0]);
Behaviour_DataOrb.setDataTitle(tOutput, "Elemental-Scan"); Behaviour_DataOrb.setDataTitle(tOutput, "Elemental-Scan");
@ -680,7 +684,6 @@ public class GT_Mod
GregTech_API.mInputRF = false; GregTech_API.mInputRF = false;
} }
} }
Materials.initMaterialProperties();
achievements = new GT_Achievements(); achievements = new GT_Achievements();
Map.Entry<IRecipeInput, RecipeOutput> tRecipe; Map.Entry<IRecipeInput, RecipeOutput> tRecipe;
GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables."); GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables.");

View file

@ -1,5 +1,6 @@
package gregtech.api.enums; package gregtech.api.enums;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API; import gregtech.api.GregTech_API;
import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.enums.TC_Aspects.TC_AspectStack;
import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IColorModulationContainer;
@ -17,8 +18,8 @@ import java.util.*;
import static gregtech.api.enums.GT_Values.M; import static gregtech.api.enums.GT_Values.M;
public class Materials implements IColorModulationContainer, ISubTagContainer { public class Materials implements IColorModulationContainer, ISubTagContainer {
public static Collection<Materials> VALUES = new HashSet<Materials>(); public static Map<String, Materials> MATERIALS = new HashMap<String, Materials>();
public static Collection<Materials> VALUES_CUSTOM = new HashSet<Materials>(); public static Map<String, Materials> MATERIALS_CUSTOM = new HashMap<String, Materials>();
/** /**
* This is the Default Material returned in case no Material has been found or a NullPointer has been inserted at a location where it shouldn't happen. * This is the Default Material returned in case no Material has been found or a NullPointer has been inserted at a location where it shouldn't happen.
@ -706,19 +707,19 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
public TextureSet mIconSet; public TextureSet mIconSet;
public int mMetaItemSubID; public int mMetaItemSubID;
public boolean mUnificatable; public boolean mUnificatable;
public final Materials mMaterialInto; public Materials mMaterialInto;
public final List<MaterialStack> mMaterialList = new ArrayList<MaterialStack>(); public List<MaterialStack> mMaterialList = new ArrayList<MaterialStack>();
public final List<Materials> mOreByProducts = new ArrayList<Materials>(), mOreReRegistrations = new ArrayList<Materials>(); public List<Materials> mOreByProducts = new ArrayList<Materials>(), mOreReRegistrations = new ArrayList<Materials>();
public final List<TC_Aspects.TC_AspectStack> mAspects = new ArrayList<TC_Aspects.TC_AspectStack>(); public List<TC_Aspects.TC_AspectStack> mAspects = new ArrayList<TC_Aspects.TC_AspectStack>();
private final ArrayList<ItemStack> mMaterialItems = new ArrayList<ItemStack>(); private ArrayList<ItemStack> mMaterialItems = new ArrayList<ItemStack>();
private final Collection<SubTag> mSubTags = new HashSet<SubTag>(); private Collection<SubTag> mSubTags = new HashSet<SubTag>();
public Enchantment mEnchantmentTools = null, mEnchantmentArmors = null; public Enchantment mEnchantmentTools = null, mEnchantmentArmors = null;
public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0; public byte mEnchantmentToolsLevel = 0, mEnchantmentArmorsLevel = 0;
public boolean mBlastFurnaceRequired = false, mTransparent = false; public boolean mBlastFurnaceRequired = false, mTransparent = false;
public float mToolSpeed = 1.0F, mHeatDamage = 0.0F; public float mToolSpeed = 1.0F, mHeatDamage = 0.0F;
public String mChemicalFormula = "?", mName = "null", mDefaultLocalName = "null"; public String mChemicalFormula = "?", mName = "null", mDefaultLocalName = "null";
public Dyes mColor = Dyes._NULL; public Dyes mColor = Dyes._NULL;
public short mMeltingPoint = 0, mBlastFurnaceTemp = 0; public short mMeltingPoint = 0, mBlastFurnaceTemp = 0, mGasTemp = 0;
public int mTypes = 0; // 1=?; 2=?; 4=?; 8=OreProcessing; 16=?; 32=?; 64=?; 128=?; 256=?; public int mTypes = 0; // 1=?; 2=?; 4=?; 8=OreProcessing; 16=?; 32=?; 64=?; 128=?; 256=?;
public int mDurability = 16, mFuelPower = 0, mFuelType = 0, mExtraData = 0, mOreValue = 0, mOreMultiplier = 1, mByProductMultiplier = 1, mSmeltingMultiplier = 1; public int mDurability = 16, mFuelPower = 0, mFuelType = 0, mExtraData = 0, mOreValue = 0, mOreMultiplier = 1, mByProductMultiplier = 1, mSmeltingMultiplier = 1;
public int mDensityMultiplier = 1, mDensityDivider = 1; public int mDensityMultiplier = 1, mDensityDivider = 1;
@ -728,13 +729,14 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
public byte mToolQuality = 0; public byte mToolQuality = 0;
public boolean mCustomOre = false; public boolean mCustomOre = false;
public String mCustomID = "null", mConfigSection = "null"; public String mCustomID = "null", mConfigSection = "null";
public boolean mHasPlasma = false, mHasGas = false;
public Fluid mSolid = null, mFluid = null, mGas = null, mPlasma = null; public Fluid mSolid = null, mFluid = null, mGas = null, mPlasma = null;
/** /**
* This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, that means 144 is one Material Unit worth of fluid. * This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, that means 144 is one Material Unit worth of fluid.
*/ */
public Fluid mStandardMoltenFluid = null; public Fluid mStandardMoltenFluid = null;
static { static {
initSubTags(); initSubTags();
Iron .mOreReRegistrations.add(AnyIron ); Iron .mOreReRegistrations.add(AnyIron );
@ -1261,26 +1263,16 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
} }
public static void initCustomMaterials() { public static void initCustomMaterials() {
//TODO register fluids
int i = 0; int i = 0;
StringBuilder aCustomPath = new StringBuilder();
StringBuilder aCustomID = new StringBuilder();
for (int j = GregTech_API.sMaterialProperties.get("general", "AmountOfCustomMaterialSlots", 16); i < j; i++) { for (int j = GregTech_API.sMaterialProperties.get("general", "AmountOfCustomMaterialSlots", 16); i < j; i++) {
aCustomID.append((i < 10 ? "0" : "")).append(i); String aID = (i < 10 ? "0" : "") + i;
aCustomPath.append("materials.custom.").append(aCustomID.toString()); new Materials(-1, TextureSet.SET_METALLIC, 1.0F, 0, 0, 0, 255, 255, 255, 0, "custom" + aID, 0, 0, 0, 0, false, false, 1, 1, 1, Dyes._NULL, "custom", true, aID);
int aMaterialID = GregTech_API.sMaterialProperties.get(aCustomPath.toString(), "MaterialID", -1);
String aMaterialName = GregTech_API.sMaterialProperties.get(aCustomPath.toString(), "MaterialName", "NullMat");
if (aMaterialID >= 0 && aMaterialID <= 1000 && !aMaterialName.equalsIgnoreCase("nullmat")) {
new Materials(aMaterialID, TextureSet.SET_METALLIC, 1.0F, 0, 0, 0, 255, 255, 255, 0, aMaterialName, 0, 0, 0, 0, false, false, 1, 1, 1, Dyes._NULL, "custom", true, aCustomID.toString());
}
aCustomID.setLength(0);
aCustomPath.setLength(0);
} }
} }
public static void initMaterialProperties() { public static void initMaterialProperties() {
MATERIALS.
StringBuilder aConfigPath = new StringBuilder(); StringBuilder aConfigPath = new StringBuilder();
for (Materials aMaterial : VALUES) { for (Materials aMaterial : MATERIALS.values()) {
if (aMaterial != null && aMaterial != Materials._NULL && aMaterial != Materials.Empty) { if (aMaterial != null && aMaterial != Materials._NULL && aMaterial != Materials.Empty) {
aConfigPath.append("materials.").append(aMaterial.mConfigSection).append(".").append(aMaterial.mCustomOre ? aMaterial.mCustomID : aMaterial.mName); aConfigPath.append("materials.").append(aMaterial.mConfigSection).append(".").append(aMaterial.mCustomOre ? aMaterial.mCustomID : aMaterial.mName);
aMaterial.mMetaItemSubID = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialID", aMaterial.mCustomOre ? -1 : aMaterial.mMetaItemSubID); aMaterial.mMetaItemSubID = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialID", aMaterial.mCustomOre ? -1 : aMaterial.mMetaItemSubID);
@ -1300,44 +1292,122 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
//aMaterial.mIconSet = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "IconSet", aMaterial.mIconSet); //aMaterial.mIconSet = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "IconSet", aMaterial.mIconSet);
aMaterial.mTransparent = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "Transparent", aMaterial.mTransparent); aMaterial.mTransparent = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "Transparent", aMaterial.mTransparent);
aMaterial.mColor = Dyes.get(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "DyeColor", aMaterial.mColor.mName)); aMaterial.mColor = Dyes.get(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "DyeColor", aMaterial.mColor.mName));
aMaterial.mRGBa[0] = aMaterial.mMoltenRGBa[0] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatRed", aMaterial. mRGBa[0]); aMaterial.mRGBa[0] = aMaterial.mMoltenRGBa[0] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatRed", aMaterial.mRGBa[0]);
aMaterial.mRGBa[1] = aMaterial.mMoltenRGBa[1] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatGreen", aMaterial.mRGBa[1]); aMaterial.mRGBa[1] = aMaterial.mMoltenRGBa[1] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatGreen", aMaterial.mRGBa[1]);
aMaterial.mRGBa[2] = aMaterial.mMoltenRGBa[2] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatBlue", aMaterial.mRGBa[2]); aMaterial.mRGBa[2] = aMaterial.mMoltenRGBa[2] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatBlue", aMaterial.mRGBa[2]);
aMaterial.mRGBa[3] = aMaterial.mMoltenRGBa[3] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatAlpha", aMaterial.mRGBa[3]); aMaterial.mRGBa[3] = aMaterial.mMoltenRGBa[3] = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MatAlpha", aMaterial.mRGBa[3]);
aMaterial.mTypes = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialTypes", aMaterial.mCustomOre ? 1|2|4|8|16|32|64|128 : aMaterial.mTypes); aMaterial.mTypes = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialTypes", aMaterial.mCustomOre ? 1|2|4|8|16|32|64|128 : aMaterial.mTypes);
aMaterial.mUnificatable = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "Unificatable", aMaterial.mUnificatable); aMaterial.mUnificatable = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "Unificatable", aMaterial.mUnificatable);
aMaterial.mChemicalFormula = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "ChemicalFormula", aMaterial.mChemicalFormula);
aMaterial.mGasTemp = (short) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "GasTemp", aMaterial.mGasTemp);
aMaterial.setOreMultiplier(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "OreMultiplier", aMaterial.mOreMultiplier));
aMaterial.setSmeltingMultiplier(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "OreSmeltingMultiplier", aMaterial.mSmeltingMultiplier));
aMaterial.setByProductMultiplier(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "OreByProductMultiplier", aMaterial.mByProductMultiplier));
aMaterial.setHeatDamage((float) GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "HeatDamage", aMaterial.mHeatDamage));
aMaterial.mSmeltInto = MATERIALS.get(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialSmeltInto", aMaterial.mSmeltInto.mName));
aMaterial.mMacerateInto = MATERIALS.get(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialMacerateInto", aMaterial.mMacerateInto.mName));
aMaterial.mArcSmeltInto = MATERIALS.get(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialArcSmeltInto", aMaterial.mArcSmeltInto.mName));
aMaterial.mDirectSmelting = MATERIALS.get(GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "MaterialDirectSmeltInto", aMaterial.mDirectSmelting.mName));
if (aMaterial.mHasPlasma = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "AddPlasma", aMaterial.mHasPlasma)) GT_Mod.gregtechproxy.addAutogeneratedPlasmaFluid(aMaterial);
if (aMaterial.mHasGas = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "AddGas", aMaterial.mHasGas)) GT_Mod.gregtechproxy.addFluid(aMaterial.mName.toLowerCase(), aMaterial.mDefaultLocalName, aMaterial, 2, aMaterial.mGasTemp);
//TODO
//mOreReRegistrations - Enchantments
/**
* Converts the pre-defined list of SubTags from out material into a list of SubTag names for setting/getting to/from the config.
* Then converts that List of names into a singular string[] for insertion into the config
* If the config string is different from the default, we then want to clear the Materials SubTags and insert new ones from the config string.
*/
List<String> aSubTags = new ArrayList<>();
for (SubTag aTag : aMaterial.mSubTags) aSubTags.add(aTag.mName);
String aDefaultTagString = aSubTags.toString().replace(" ", "").replace("[", "").replace("]", "");
String aConfigTagString = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "ListSubTags", aDefaultTagString);
if (!aConfigTagString.equals(aDefaultTagString)) {
aMaterial.mSubTags.clear();
if (aConfigTagString.length() > 0) {
aSubTags = new ArrayList<>(Arrays.asList(aConfigTagString.split(",")));
for (String aTagString : aSubTags) {
SubTag aTag = SubTag.sSubTags.get(aTagString);
if (aTag != null) aMaterial.mSubTags.add(aTag);
}
}
}
/**
* Same principal as SubTags
*/
List<String> aOreByProducts = new ArrayList<>();
for (Materials aMat : aMaterial.mOreByProducts) aOreByProducts.add(aMat.mName);
String aDefaultMaterialString = aOreByProducts.toString().replace(" ", "").replace("[", "").replace("]", "");
String aConfigMaterialString = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "ListMaterialByProducts", aDefaultMaterialString);
if (!aConfigMaterialString.equals(aDefaultMaterialString)) {
aMaterial.mOreByProducts.clear();
if (aConfigMaterialString.length() > 0) {
aOreByProducts = new ArrayList<>(Arrays.asList(aConfigMaterialString.split(",")));
for (String aMaterialString : aOreByProducts) {
Materials aMat = MATERIALS.get(aMaterialString);
if (aMat != null) aMaterial.mOreByProducts.add(aMat);
}
}
}
/**
* Same principal as SubTags
*/
List<String> aAspects = new ArrayList<>(); List<String> aAspects = new ArrayList<>();
ArrayList<String> aAspectAmounts = new ArrayList<>(); ArrayList<String> aAspectAmounts = new ArrayList<>();
for (TC_Aspects.TC_AspectStack aAspectStack : aMaterial.mAspects) { for (TC_Aspects.TC_AspectStack aAspectStack : aMaterial.mAspects) {
aAspects.add(aAspectStack.mAspect.toString()); aAspects.add(aAspectStack.mAspect.toString());
aAspectAmounts.add(String.valueOf(aAspectStack.mAmount)); aAspectAmounts.add(String.valueOf(aAspectStack.mAmount));
} }
String aAspectsString = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "TCAspects", aAspects.toString().replace(" ", "").replace("[", "").replace("]", "")); String aDefaultAspectString = aAspects.toString().replace(" ", "").replace("[", "").replace("]", "");
String aAspectAmountsString = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "TCAspectAmounts", aAspectAmounts.toString().replace(" ", "").replace("[", "").replace("]", "")); String aDefaultAspectAmountString = aAspectAmounts.toString().replace(" ", "").replace("[", "").replace("]", "");
String aConfigAspectString = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "ListTCAspects", aDefaultAspectString);
aAspects = new ArrayList<>(Arrays.asList(aAspectsString.split(","))); String aConfigAspectAmountString = GregTech_API.sMaterialProperties.get(aConfigPath.toString(), "ListTCAspectAmounts", aDefaultAspectAmountString);
aAspectAmounts = new ArrayList<>(Arrays.asList(aAspectAmountsString.split(","))); if (!aConfigAspectString.equals(aDefaultAspectString) || !aConfigAspectAmountString.equals(aDefaultAspectAmountString)) {
aMaterial.mAspects.clear();
for (int x = 0; x < aAspects.size(); x++) { if (aConfigAspectString.length() > 0) {
String str = aAspects.get(x); aAspects = new ArrayList<>(Arrays.asList(aConfigAspectString.split(",")));
if (!str.isEmpty()) { for (int i = 0; i < aAspects.size(); i++) {
TC_AspectStack aAspectStack = new TC_AspectStack(TC_Aspects.valueOf(str), Long.parseLong(aAspectAmounts.get(x))); String aAspectString = aAspects.get(i);
if (!aMaterial.mAspects.contains(aAspectStack)) aMaterial.mAspects.add(aAspectStack); long aAspectAmount = Long.parseLong(aAspectAmounts.get(i));
TC_AspectStack aAspectStack = new TC_AspectStack(TC_Aspects.valueOf(aAspectString), aAspectAmount);
if (aAspectStack != null) aMaterial.mAspects.add(aAspectStack);
}
} }
} }
//End of updating values from the config
} }
//Temp code for testing
aConfigPath.setLength(0); aConfigPath.setLength(0);
StringBuilder sb = new StringBuilder();
sb.append("##### - ").append(aMaterial.mName).append(": ");
for (SubTag aTag : aMaterial.mSubTags) {
sb.append(aTag.mName).append(",");
}
System.out.println(sb.toString());
} }
} }
public static void initGeneratedMaterials() {
for (Materials aMaterial : MATERIALS.values()) {
if (aMaterial.mMetaItemSubID >= 0) {
if (aMaterial.mMetaItemSubID < 1000) {
if (GregTech_API.sGeneratedMaterials[aMaterial.mMetaItemSubID] == null) {
GregTech_API.sGeneratedMaterials[aMaterial.mMetaItemSubID] = aMaterial;
} else throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + " is already used!");
} else throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + " is over the maximum of 1000");
}
}
}
public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, boolean aUnificatable) { public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, boolean aUnificatable) {
this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aUnificatable, "ore", false, "null"); this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, aUnificatable, "ore", false, "null");
} }
public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, boolean aUnificatable, String aConfigSection, boolean aCustomOre, String aCustomID) { public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, boolean aUnificatable, String aConfigSection, boolean aCustomOre, String aCustomID) {
VALUES.add(this); mName = mDefaultLocalName.contains(" ") ? mDefaultLocalName.replaceAll(" ", "") : mDefaultLocalName;
if (aCustomOre) VALUES_CUSTOM.add(this); MATERIALS.put(mName, this);
if (aCustomOre) MATERIALS_CUSTOM.put(mName, this);
mCustomOre = aCustomOre; mCustomOre = aCustomOre;
mCustomID = aCustomID; mCustomID = aCustomID;
mConfigSection = aConfigSection; mConfigSection = aConfigSection;
@ -1348,13 +1418,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
mToolQuality = (byte) aToolQuality; mToolQuality = (byte) aToolQuality;
mMaterialInto = this; mMaterialInto = this;
mIconSet = aIconSet; mIconSet = aIconSet;
if (aMetaItemSubID >= 0) {
if (aMetaItemSubID < 1000) {
if (GregTech_API.sGeneratedMaterials[aMetaItemSubID] == null) {
GregTech_API.sGeneratedMaterials[aMetaItemSubID] = this;
} else throw new IllegalArgumentException("The Material Index " + aMetaItemSubID + " is already used!");
} else throw new IllegalArgumentException("The Material Index " + aMetaItemSubID + " is over the maximum of 1000");
}
} }
public Materials(Materials aMaterialInto, boolean aReRegisterIntoThis) { public Materials(Materials aMaterialInto, boolean aReRegisterIntoThis) {
@ -1378,7 +1441,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, String aConfigSection, boolean aCustomOre, String aCustomID) { public Materials(int aMetaItemSubID, TextureSet aIconSet, float aToolSpeed, int aDurability, int aToolQuality, int aTypes, int aR, int aG, int aB, int aA, String aDefaultLocalName, int aFuelType, int aFuelPower, int aMeltingPoint, int aBlastFurnaceTemp, boolean aBlastFurnaceRequired, boolean aTransparent, int aOreValue, int aDensityMultiplier, int aDensityDivider, Dyes aColor, String aConfigSection, boolean aCustomOre, String aCustomID) {
this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, true, aConfigSection, aCustomOre, aCustomID); this(aMetaItemSubID, aIconSet, aToolSpeed, aDurability, aToolQuality, true, aConfigSection, aCustomOre, aCustomID);
mDefaultLocalName = aDefaultLocalName; mDefaultLocalName = aDefaultLocalName;
mName = mDefaultLocalName.contains(" ") ? mDefaultLocalName.replaceAll(" ", "") : mDefaultLocalName;
mMeltingPoint = (short) aMeltingPoint; mMeltingPoint = (short) aMeltingPoint;
mBlastFurnaceRequired = aBlastFurnaceRequired; mBlastFurnaceRequired = aBlastFurnaceRequired;
mBlastFurnaceTemp = (short) aBlastFurnaceTemp; mBlastFurnaceTemp = (short) aBlastFurnaceTemp;

View file

@ -3,8 +3,8 @@ package gregtech.api.enums;
import gregtech.api.interfaces.ICondition; import gregtech.api.interfaces.ICondition;
import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.interfaces.ISubTagContainer;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
/** /**
@ -21,7 +21,7 @@ import java.util.HashSet;
* Some SubTags are used for other things than Materials too. It is useful when I need an easy way to declare Stuff in Items. * Some SubTags are used for other things than Materials too. It is useful when I need an easy way to declare Stuff in Items.
*/ */
public final class SubTag implements ICondition<ISubTagContainer> { public final class SubTag implements ICondition<ISubTagContainer> {
public static final ArrayList<SubTag> sSubTags = new ArrayList<SubTag>(); public static final HashMap<String, SubTag> sSubTags = new HashMap<String, SubTag>();
private static long sSubtagID = 0; private static long sSubtagID = 0;
public final long mSubtagID; public final long mSubtagID;
public final String mName; public final String mName;
@ -231,11 +231,11 @@ public final class SubTag implements ICondition<ISubTagContainer> {
private SubTag(String aName) { private SubTag(String aName) {
mSubtagID = sSubtagID++; mSubtagID = sSubtagID++;
mName = aName; mName = aName;
sSubTags.add(this); sSubTags.put(aName, this);
} }
public static SubTag getNewSubTag(String aName) { public static SubTag getNewSubTag(String aName) {
for (SubTag tSubTag : sSubTags) if (tSubTag.mName.equals(aName)) return tSubTag; for (SubTag tSubTag : sSubTags.values()) if (tSubTag.mName.equals(aName)) return tSubTag;
return new SubTag(aName); return new SubTag(aName);
} }

View file

@ -492,7 +492,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
GT_Log.out.println("GT_Mod: Adding Tool Usage Crafting Recipes for OreDict Items."); GT_Log.out.println("GT_Mod: Adding Tool Usage Crafting Recipes for OreDict Items.");
long tBits = GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED long tBits = GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED
| GT_ModHandler.RecipeBits.ONLY_ADD_IF_RESULT_IS_NOT_NULL | GT_ModHandler.RecipeBits.NOT_REMOVABLE; | GT_ModHandler.RecipeBits.ONLY_ADD_IF_RESULT_IS_NOT_NULL | GT_ModHandler.RecipeBits.NOT_REMOVABLE;
for (Materials aMaterial : Materials.VALUES) { for (Materials aMaterial : Materials.MATERIALS.values()) {
if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial)) { if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial)) {
if (!aMaterial.contains(SubTag.NO_SMASHING)) { if (!aMaterial.contains(SubTag.NO_SMASHING)) {
if (GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) { if (GregTech_API.sRecipeFile.get(ConfigCategories.Tools.hammerplating, aMaterial.toString(), true)) {

View file

@ -13,7 +13,7 @@ import net.minecraft.init.Blocks;
public class GT_Block_Ores extends GT_Block_Ores_Abstract { public class GT_Block_Ores extends GT_Block_Ores_Abstract {
public GT_Block_Ores() { public GT_Block_Ores() {
super("gt.blockores", 7, false, Material.rock); super("gt.blockores", 7, Material.rock);
} }
@Override @Override

View file

@ -38,7 +38,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
public static boolean tHideOres; public static boolean tHideOres;
public static int tOreMetaCount; public static int tOreMetaCount;
protected GT_Block_Ores_Abstract(String aUnlocalizedName, int aOreMetaCount, boolean aHideFirstMeta, Material aMaterial) { protected GT_Block_Ores_Abstract(String aUnlocalizedName, int aOreMetaCount, Material aMaterial) {
super(GT_Item_Ores.class, aUnlocalizedName, aMaterial); super(GT_Item_Ores.class, aUnlocalizedName, aMaterial);
this.isBlockContainer = true; this.isBlockContainer = true;
setStepSound(soundTypeStone); setStepSound(soundTypeStone);
@ -58,7 +58,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) { if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) {
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000))); GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000)));
if (tHideOres) { if (tHideOres) {
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, (j == 0 && aHideFirstMeta) ? i : i + (j * 1000))); if (!aUnlocalizedName.equals("gt.blockores") && !(i + (j * 1000) < 1000)) codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + (j * 1000)));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, (i + 16000) + (j * 1000))); codechicken.nei.api.API.hideItem(new ItemStack(this, 1, (i + 16000) + (j * 1000)));
} }
} }

View file

@ -15,7 +15,7 @@ public class GT_Block_Ores_GC extends GT_Block_Ores_Abstract {
Block aMarsBlock = GameRegistry.findBlock("GalacticraftMars", "tile.mars"); Block aMarsBlock = GameRegistry.findBlock("GalacticraftMars", "tile.mars");
public GT_Block_Ores_GC() { public GT_Block_Ores_GC() {
super("gt.blockores.gc", 4, true, Material.rock); super("gt.blockores.gc", 4, Material.rock);
if (aMoonBlock == null) aMoonBlock = Blocks.stone; if (aMoonBlock == null) aMoonBlock = Blocks.stone;
if (aMarsBlock == null) aMarsBlock = Blocks.stone; if (aMarsBlock == null) aMarsBlock = Blocks.stone;
} }

View file

@ -14,7 +14,7 @@ public class GT_Block_Ores_UB1 extends GT_Block_Ores_Abstract {
Block aUBBlock = GameRegistry.findBlock("UndergroundBiomes", "igneousStone"); Block aUBBlock = GameRegistry.findBlock("UndergroundBiomes", "igneousStone");
public GT_Block_Ores_UB1() { public GT_Block_Ores_UB1() {
super("gt.blockores.ub1", 8, true, Material.rock); super("gt.blockores.ub1", 8, Material.rock);
if (aUBBlock == null) aUBBlock = Blocks.stone; if (aUBBlock == null) aUBBlock = Blocks.stone;
} }

View file

@ -14,7 +14,7 @@ public class GT_Block_Ores_UB2 extends GT_Block_Ores_Abstract {
Block aUBBlock = GameRegistry.findBlock("UndergroundBiomes", "metamorphicStone"); Block aUBBlock = GameRegistry.findBlock("UndergroundBiomes", "metamorphicStone");
public GT_Block_Ores_UB2() { public GT_Block_Ores_UB2() {
super("gt.blockores.ub2", 8, true, Material.rock); super("gt.blockores.ub2", 8, Material.rock);
if (aUBBlock == null) aUBBlock = Blocks.stone; if (aUBBlock == null) aUBBlock = Blocks.stone;
} }

View file

@ -14,7 +14,7 @@ public class GT_Block_Ores_UB3 extends GT_Block_Ores_Abstract {
Block aUBBlock = GameRegistry.findBlock("UndergroundBiomes", "sedimentaryStone"); Block aUBBlock = GameRegistry.findBlock("UndergroundBiomes", "sedimentaryStone");
public GT_Block_Ores_UB3() { public GT_Block_Ores_UB3() {
super("gt.blockores.ub3", 8, true, Material.rock); super("gt.blockores.ub3", 8, Material.rock);
if (aUBBlock == null) aUBBlock = Blocks.stone; if (aUBBlock == null) aUBBlock = Blocks.stone;
} }

View file

@ -84,7 +84,7 @@ public class GT_MetaTileEntity_Replicator
public int getCapacity() { public int getCapacity() {
if ((sHeaviestElementMass == 0) && (GregTech_API.sPostloadFinished)) { if ((sHeaviestElementMass == 0) && (GregTech_API.sPostloadFinished)) {
Materials tMaterial; Materials tMaterial;
for (Iterator i$ = Materials.VALUES.iterator(); i$.hasNext(); sHeaviestElementMass = Math.max(sHeaviestElementMass, (int) tMaterial.getMass())) { for (Iterator i$ = Materials.MATERIALS.values().iterator(); i$.hasNext(); sHeaviestElementMass = Math.max(sHeaviestElementMass, (int) tMaterial.getMass())) {
tMaterial = (Materials) i$.next(); tMaterial = (Materials) i$.next();
if ((tMaterial.mElement == null) || (tMaterial.mElement.mIsIsotope)) { if ((tMaterial.mElement == null) || (tMaterial.mElement.mIsIsotope)) {
} }

View file

@ -410,7 +410,7 @@ if(Loader.isModLoaded("Railcraft")){
GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lazurite, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), ItemList.Circuit_Parts_Advanced.get(2L, new Object[0]), 32, 64); GT_Values.RA.addFormingPressRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Lazurite, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), ItemList.Circuit_Parts_Advanced.get(2L, new Object[0]), 32, 64);
GT_Values.RA.addFormingPressRecipe(ItemList.Food_Dough_Sugar.get(4L, new Object[0]), ItemList.Shape_Mold_Cylinder.get(0L, new Object[0]), ItemList.Food_Raw_Cake.get(1L, new Object[0]), 384, 4); GT_Values.RA.addFormingPressRecipe(ItemList.Food_Dough_Sugar.get(4L, new Object[0]), ItemList.Shape_Mold_Cylinder.get(0L, new Object[0]), ItemList.Food_Raw_Cake.get(1L, new Object[0]), 384, 4);
GT_Values.RA.addFormingPressRecipe(new ItemStack(Blocks.glass, 1, 32767), ItemList.Shape_Mold_Arrow.get(0L, new Object[0]), ItemList.Arrow_Head_Glass_Emtpy.get(1L, new Object[0]), 64, 4); GT_Values.RA.addFormingPressRecipe(new ItemStack(Blocks.glass, 1, 32767), ItemList.Shape_Mold_Arrow.get(0L, new Object[0]), ItemList.Arrow_Head_Glass_Emtpy.get(1L, new Object[0]), 64, 4);
for (Materials tMat : Materials.VALUES) { for (Materials tMat : Materials.MATERIALS.values()) {
if ((tMat.mStandardMoltenFluid != null) && (tMat.contains(SubTag.SOLDERING_MATERIAL))) { if ((tMat.mStandardMoltenFluid != null) && (tMat.contains(SubTag.SOLDERING_MATERIAL))) {
int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2; int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2;

View file

@ -462,7 +462,7 @@ public class GT_Loader_Item_Block_And_Fluid
GT_Mod.gregtechproxy.addFluid("molten.redstone", "Molten Redstone", Materials.Redstone, 4, 500); GT_Mod.gregtechproxy.addFluid("molten.redstone", "Molten Redstone", Materials.Redstone, 4, 500);
GT_Mod.gregtechproxy.addFluid("molten.blaze", "Molten Blaze", Materials.Blaze, 4, 6400); GT_Mod.gregtechproxy.addFluid("molten.blaze", "Molten Blaze", Materials.Blaze, 4, 6400);
GT_Mod.gregtechproxy.addFluid("molten.concrete", "Wet Concrete", Materials.Concrete, 4, 300); GT_Mod.gregtechproxy.addFluid("molten.concrete", "Wet Concrete", Materials.Concrete, 4, 300);
for (Materials tMaterial : Materials.VALUES) { for (Materials tMaterial : Materials.MATERIALS.values()) {
if ((tMaterial.mStandardMoltenFluid == null) && (tMaterial.contains(SubTag.SMELTING_TO_FLUID)) && (!tMaterial.contains(SubTag.NO_SMELTING))) { if ((tMaterial.mStandardMoltenFluid == null) && (tMaterial.contains(SubTag.SMELTING_TO_FLUID)) && (!tMaterial.contains(SubTag.NO_SMELTING))) {
GT_Mod.gregtechproxy.addAutogeneratedMoltenFluid(tMaterial); GT_Mod.gregtechproxy.addAutogeneratedMoltenFluid(tMaterial);
if ((tMaterial.mSmeltInto != tMaterial) && (tMaterial.mSmeltInto.mStandardMoltenFluid == null)) { if ((tMaterial.mSmeltInto != tMaterial) && (tMaterial.mSmeltInto.mStandardMoltenFluid == null)) {