mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 12:32:29 +00:00
- Expanded GregTech support to 1.7.10
- Expanded MFR support to 1.7.10 - Improved MFR implementation, no longer uses reflection. Yay! - Registration of a class registry now allows a description to be shown when loaded. Handy to check if mod support loaded properly. - Fixed a few bugs in MFR support - Fixed 1.7.2 IC2 item bracket handler
This commit is contained in:
1 parent
154c2242f9
commit
b50a88227b
79 files changed
+6230
-350
No files matched your search
@@ -213,6 +213,18 @@ public class MineTweakerAPI {
|
||||
* @param registryClass
|
||||
*/
|
||||
public static void registerClassRegistry(Class registryClass) {
|
||||
registerClassRegistry(registryClass, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a class registry class. Such class must have (at least) a public
|
||||
* static method called "getClasses" with accepts a List of classes and which
|
||||
* stores its classes into that list.
|
||||
*
|
||||
* @param registryClass
|
||||
* @param description
|
||||
*/
|
||||
public static void registerClassRegistry(Class registryClass, String description) {
|
||||
try {
|
||||
Method method = registryClass.getMethod("getClasses", List.class);
|
||||
if ((method.getModifiers() & Modifier.STATIC) == 0) {
|
||||
@@ -235,6 +247,9 @@ public class MineTweakerAPI {
|
||||
|
||||
MineTweakerAPI.registerClass(cls);
|
||||
}
|
||||
|
||||
if (description != null)
|
||||
System.out.println("Loaded class registry: " + description);
|
||||
}
|
||||
} catch (NoSuchMethodException ex) {
|
||||
|
||||
@@ -253,8 +268,20 @@ public class MineTweakerAPI {
|
||||
* @return true if registration was successful
|
||||
*/
|
||||
public static boolean registerClassRegistry(String className) {
|
||||
return registerClassRegistry(className, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a class registry. Will attempt to resolve the given class
|
||||
* name. Does nothing if the class could not be loaded.
|
||||
*
|
||||
* @param className class name to be loaded
|
||||
* @param description
|
||||
* @return true if registration was successful
|
||||
*/
|
||||
public static boolean registerClassRegistry(String className, String description) {
|
||||
try {
|
||||
registerClassRegistry(Class.forName(className));
|
||||
registerClassRegistry(Class.forName(className), description);
|
||||
return true;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user