diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-03-25 03:55:36 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-03-25 03:55:36 +0800 |
| commit | 995b8b58aa8c890c9181ae479e12a4facfa05a25 (patch) | |
| tree | a16149371fc4b69a73e2ab13e2d96cd2c324b43a /runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java | |
| parent | a34a748d2b6cdb1f70f176f1ec1bd27cbc2a98cf (diff) | |
| download | RoughlyEnoughItems-995b8b58aa8c890c9181ae479e12a4facfa05a25.tar.gz RoughlyEnoughItems-995b8b58aa8c890c9181ae479e12a4facfa05a25.tar.bz2 RoughlyEnoughItems-995b8b58aa8c890c9181ae479e12a4facfa05a25.zip | |
Relocate most of the internal classes to match the api
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java')
| -rw-r--r-- | runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java index e817493be..a75362eb6 100644 --- a/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java +++ b/runtime/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsInitializer.java @@ -40,35 +40,39 @@ public class RoughlyEnoughItemsInitializer { } if (RoughlyEnoughItemsState.getErrors().isEmpty()) { - initializeEntryPoint("me.shedaniel.rei.RoughlyEnoughItemsNetwork"); + initializeEntryPoint(false, "me.shedaniel.rei.RoughlyEnoughItemsCore"); } } public static void onInitializeClient() { if (RoughlyEnoughItemsState.getErrors().isEmpty()) { - initializeEntryPoint("me.shedaniel.rei.RoughlyEnoughItemsCore"); - initializeEntryPoint("me.shedaniel.rei.REIModMenuEntryPoint"); - initializeEntryPoint("me.shedaniel.rei.impl.ClientHelperImpl"); - initializeEntryPoint("me.shedaniel.rei.impl.REIHelperImpl"); + initializeEntryPoint(true, "me.shedaniel.rei.RoughlyEnoughItemsCore"); + initializeEntryPoint(true, "me.shedaniel.rei.REIModMenuEntryPoint"); + initializeEntryPoint(true, "me.shedaniel.rei.impl.client.ClientHelperImpl"); + initializeEntryPoint(true, "me.shedaniel.rei.impl.client.REIHelperImpl"); } - initializeEntryPoint("me.shedaniel.rei.impl.ErrorDisplayer"); + initializeEntryPoint(true, "me.shedaniel.rei.impl.client.ErrorDisplayer"); } - public static void initializeEntryPoint(String className) { + public static void initializeEntryPoint(boolean client, String className) { try { Class<?> name = Class.forName(className); Object instance = name.getConstructor().newInstance(); Method method = null; - try { - method = name.getDeclaredMethod("onInitialize"); - } catch (NoSuchMethodException ignored) { - } - if (method != null) { - method.invoke(instance); - } else if (Platform.getEnv() == EnvType.CLIENT) { + if (client) { + if (Platform.getEnv() == EnvType.CLIENT) { + try { + method = name.getDeclaredMethod("onInitializeClient"); + } catch (NoSuchMethodException ignored) { + } + if (method != null) { + method.invoke(instance); + } + } + } else { try { - method = name.getDeclaredMethod("onInitializeClient"); + method = name.getDeclaredMethod("onInitialize"); } catch (NoSuchMethodException ignored) { } if (method != null) { |
