|
11 | 11 | import com.gtnewhorizons.angelica.glsm.loading.DependencyVerifier; |
12 | 12 | import com.gtnewhorizons.angelica.glsm.loading.EcosystemNarrowRules; |
13 | 13 | import com.gtnewhorizons.angelica.loading.fml.compat.CompatHandlers; |
| 14 | +import com.gtnewhorizons.angelica.lwjgl3.MissingDependencySdl; |
14 | 15 | import com.gtnewhorizons.angelica.mixins.Mixins; |
15 | 16 | import com.gtnewhorizons.retrofuturabootstrap.SharedConfig; |
16 | 17 | import cpw.mods.fml.relauncher.FMLLaunchHandler; |
|
29 | 30 | import org.spongepowered.asm.launch.GlobalProperties; |
30 | 31 | import org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper; |
31 | 32 |
|
| 33 | +import javax.swing.JOptionPane; |
| 34 | +import java.awt.GraphicsEnvironment; |
32 | 35 | import java.util.ArrayList; |
33 | 36 | import java.util.Arrays; |
34 | 37 | import java.util.List; |
@@ -101,14 +104,37 @@ private static void addLwjgl3ifyExclusions() { |
101 | 104 | } |
102 | 105 |
|
103 | 106 | private static void verifyDependencies() { |
104 | | - DependencyVerifier.verify(AngelicaTweaker.class, List.of( |
105 | | - new DependencyVerifier.Check( |
106 | | - "/it/unimi/dsi/fastutil/ints/Int2ObjectMap.class", |
107 | | - "Missing dependency: Angelica requires GTNHLib! Download: https://modrinth.com/mod/gtnhlib"), |
108 | | - new DependencyVerifier.Check( |
109 | | - "/com/gtnewhorizon/gtnhlib/client/renderer/VertexCallbackManager.class", |
110 | | - "GTNHLib is outdated: Angelica requires GTNHLib 0.10.0 or newer! Download: https://modrinth.com/mod/gtnhlib") |
111 | | - )); |
| 107 | + try { |
| 108 | + DependencyVerifier.verify(AngelicaTweaker.class, List.of( |
| 109 | + new DependencyVerifier.Check( |
| 110 | + "/it/unimi/dsi/fastutil/ints/Int2ObjectMap.class", |
| 111 | + "Missing dependency: Angelica requires GTNHLib! Download: https://modrinth.com/mod/gtnhlib"), |
| 112 | + new DependencyVerifier.Check( |
| 113 | + "/com/gtnewhorizon/gtnhlib/client/renderer/VertexCallbackManager.class", |
| 114 | + "GTNHLib is outdated: Angelica requires GTNHLib 0.10.0 or newer! Download: https://modrinth.com/mod/gtnhlib") |
| 115 | + )); |
| 116 | + } catch (RuntimeException ex) { |
| 117 | + fatalDependencyError(ex.getMessage()); |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + private static void fatalDependencyError(String message) { |
| 122 | + final String title = "Angelica - Missing Dependency"; |
| 123 | + System.err.println("FATAL: " + message); |
| 124 | + try { |
| 125 | + LOGGER.fatal(message); |
| 126 | + } catch (Throwable ignored) {} |
| 127 | + |
| 128 | + final int lwjgl3ifyMajor = ((Integer) Launch.blackboard.getOrDefault("lwjgl3ify:major-version", Integer.MIN_VALUE)); |
| 129 | + try { |
| 130 | + if (lwjgl3ifyMajor >= 3) { |
| 131 | + MissingDependencySdl.showFatal(title, message); |
| 132 | + } else if (!GraphicsEnvironment.isHeadless()) { |
| 133 | + JOptionPane.showMessageDialog(null, message, title, JOptionPane.ERROR_MESSAGE); |
| 134 | + } |
| 135 | + } catch (Throwable ignored) {} |
| 136 | + |
| 137 | + Runtime.getRuntime().halt(1); |
112 | 138 | } |
113 | 139 |
|
114 | 140 | @Override |
|
0 commit comments