Some cleanup
This commit is contained in:
parent
a987228a6a
commit
5a94ea039b
4 changed files with 17 additions and 42 deletions
|
@ -19,9 +19,8 @@ import java.util.*;
|
|||
import static gregtech.api.enums.GT_Values.M;
|
||||
|
||||
public class Materials implements IColorModulationContainer, ISubTagContainer {
|
||||
private static Materials[] MATERIALS_ARRAY = new Materials[50000];
|
||||
private static Materials[] MATERIALS_ARRAY = new Materials[]{};
|
||||
private static final Map<String, Materials> MATERIALS_MAP = new HashMap<String, Materials>();
|
||||
private static final List<Integer> USED_IDS = new ArrayList<Integer>();
|
||||
private static final List<IMaterialRegistrator> mMaterialRegistrators = new ArrayList<IMaterialRegistrator>();
|
||||
|
||||
/**
|
||||
|
@ -1264,7 +1263,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
}
|
||||
|
||||
public static void init() {
|
||||
Materials Muranium = new Materials(378, TextureSet.SET_NONE, 1.0F, 9999, 2, 1|2|8|32|64|128, 92, 0, 168, 0, "Muranium", 1, 50, 1337, 1337, true, false, 3, 1, 1, Dyes.dyePurple);
|
||||
for (IMaterialRegistrator aRegistrator : mMaterialRegistrators) {
|
||||
aRegistrator.onMaterialsInit();
|
||||
}
|
||||
|
@ -1275,10 +1273,16 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
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 + " for " + aMaterial.mName + "is already used!");
|
||||
} else throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + " for " + aMaterial.mName + " is already used!");
|
||||
} else throw new IllegalArgumentException("The Material Index " + aMaterial.mMetaItemSubID + " for " + aMaterial.mName + " is/over the maximum of 1000");
|
||||
}
|
||||
}
|
||||
// Fills empty spaces with materials, causes horrible load times.
|
||||
/*for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
|
||||
if (GregTech_API.sGeneratedMaterials[i] == null) {
|
||||
GregTech_API.sGeneratedMaterials[i] = new Materials(i, TextureSet.SET_NONE, 1.0F, 0, 2, 1|2|4|8|16|32|64|128, 92, 0, 168, 0, "TestMat" + i, 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL, "testmat");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public static void initMaterialProperties() {
|
||||
|
@ -1423,7 +1427,6 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
mDefaultLocalName = aDefaultLocalName;
|
||||
mName = aDefaultLocalName.contains(" ") ? aDefaultLocalName.replaceAll(" ", "") : aDefaultLocalName;
|
||||
MATERIALS_MAP.put(mName, this);
|
||||
USED_IDS.add(aMetaItemSubID);
|
||||
mCustomOre = aCustomOre;
|
||||
mCustomID = aCustomID;
|
||||
mConfigSection = aConfigSection;
|
||||
|
@ -1524,26 +1527,27 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
else mAspects.addAll(aAspects);
|
||||
}
|
||||
|
||||
/** This is for keeping compatibility with addons mods (Such as TinkersGregworks) that looped over the old materials enum **/
|
||||
/**
|
||||
* This is for keeping compatibility with addons mods (Such as TinkersGregworks) that looped over the old materials enum
|
||||
*/
|
||||
public String name() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
/** This is for keeping compatibility with addons mods (Such as TinkersGregworks) that looped over the old materials enum **/
|
||||
/**
|
||||
* This is for keeping compatibility with addons mods (Such as TinkersGregworks) that looped over the old materials enum
|
||||
*/
|
||||
public static Materials[] values() {
|
||||
return MATERIALS_ARRAY;
|
||||
}
|
||||
|
||||
/** This should only be used for getting a Material by its name as a String. Do not loop over this map, use values(). **/
|
||||
/**
|
||||
* This should only be used for getting a Material by its name as a String. Do not loop over this map, use values().
|
||||
*/
|
||||
public static Map<String, Materials> getMaterialsMap() {
|
||||
return MATERIALS_MAP;
|
||||
}
|
||||
|
||||
/** Useful for checking if a Material ID is already being used. This is a List so the 'contains()' method can be used. **/
|
||||
public static List<Integer> getUsedIds() {
|
||||
return USED_IDS;
|
||||
}
|
||||
|
||||
public static Materials get(String aMaterialName) {
|
||||
return getMaterialsMap().get(aMaterialName);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Iterator;
|
|||
public class GT_ItemIterator
|
||||
implements Runnable {
|
||||
public void run() {
|
||||
System.out.println("##### Started Item Iter");
|
||||
GT_Log.out.println("GT_Mod: Scanning for certain kinds of compatible Machineblocks.");
|
||||
ItemStack tStack2;
|
||||
ItemStack tStack;
|
||||
|
@ -181,9 +180,7 @@ public class GT_ItemIterator
|
|||
GT_OreDictUnificator.registerOre("bookThaumonomicon", new ItemStack(tItem, 1, 32767));
|
||||
}
|
||||
if (tName.equals("item.ligniteCoal")) {
|
||||
System.out.println("#### Started Lignite");
|
||||
GT_OreDictUnificator.set(OrePrefixes.gem, Materials.Lignite, new ItemStack(tItem, 1, 0));
|
||||
System.out.println("#### Ended Lignite");
|
||||
}
|
||||
if ((tName.equals("tile.extrabiomes.redrock")) || (tName.equals("tile.bop.redRocks"))) {
|
||||
GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Redrock, new ItemStack(tItem, 1, 0));
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package gregtech.loaders.materialprocessing;
|
||||
|
||||
import gregtech.api.GregTech_API;
|
||||
import gregtech.api.enums.Dyes;
|
||||
import gregtech.api.enums.Materials;
|
||||
import gregtech.api.enums.TextureSet;
|
||||
|
||||
public class ProcessingTest implements gregtech.api.interfaces.IMaterialRegistrator {
|
||||
public ProcessingTest() {
|
||||
Materials.add(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Just a test class to fill the empty spaces in sGeneratedMaterials for performance testing.
|
||||
* This is disabled in GT_Loader_MaterialProcessing, but can be enabled for testing.
|
||||
*/
|
||||
@Override
|
||||
public void onMaterialsInit() {
|
||||
for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
|
||||
if (!Materials.getUsedIds().contains(i)) {
|
||||
new Materials(i, TextureSet.SET_NONE, 1.0F, 0, 2, 1|2|4|8|16|32|64|128, 92, 0, 168, 0, "TestMat" + i, 0, 0, -1, 0, false, false, 3, 1, 1, Dyes._NULL, "testmat");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,6 +7,5 @@ public class GT_Loader_MaterialProcessing implements Runnable {
|
|||
public void run() {
|
||||
GT_Log.out.println("GT_Mod: Register Material processing.");
|
||||
new ProcessingConfig();
|
||||
//new ProcessingTest();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue