mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 01:54:46 +00:00
The Great Refractor!
This commit is contained in:
1 parent
aa52debeb5
commit
5b5e29a8ce
92 files changed
+1616
-1452
No files matched your search
@@ -0,0 +1,49 @@
|
||||
package info.jbcs.minecraft.chisel.compat;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user