First of all, the ELIB module is added to the Run/MODS directory of the project to facilitate debugging.
Then add a function to determine whether the module is loaded and call ELIB.
example:
Public Static String Runelibfunction (String FunctionName, String ... ARGS) Throws Exception {If (modlist.get (). Isloaded ("elib")) {{
Class <?> Clazz = class.Forname ("cn.ksmcBrigade.elib.libs");
Class <?> [] Parameterpes = New Class [ARGS.Length];
For (int i = 0; I
Parametertypes [i] = string.class;
}
Method method = Clazz.getDeClaredMethod (functionName, ParameterTypes);
Method.setaccessible (true);
Object instance = Clazz.getDeclaredConstructor (). Newinstance ();
Return
}
Else {
Return "";}
}
The above code needs to be introduced in the following two categories:
net.mineCraftForge.fml.modList
java.lang.reflect.method
Finally, just call the written function.