Files
Chisel/src/main/java/info/jbcs/minecraft/chisel/compat/ModIntegration.java
T

49 lines
1.2 KiB
Java
Raw Normal View History

2014-10-28 21:10:08 -04:00
package info.jbcs.minecraft.chisel.compat;
import java.util.ArrayList;
import java.util.List;
2014-12-14 20:05:39 +00:00
import cpw.mods.fml.common.Loader;
2014-10-28 21:10:08 -04:00
public class ModIntegration {
private static List<IModIntegration> integratedMods = new ArrayList<IModIntegration>();
public static void addMod(Class<? extends IModIntegration> cls){
try{
IModIntegration obj = cls.newInstance();
if(Loader.isModLoaded(obj.getModId())){
integratedMods.add(obj);
}
} catch(Throwable throwable){
throwable.printStackTrace();
}
}
public static void init(){
try{
for(IModIntegration integration : integratedMods){
integration.onInit();
}
} catch (Throwable throwable){
throwable.printStackTrace();
}
}
public static void postInit(){
try {
for (IModIntegration integration : integratedMods){
integration.onPostInit();
}
} catch (Throwable throwable){
throwable.printStackTrace();
}
}
static interface IModIntegration{
String getModId();
void onInit();
void onPostInit();
}
}