aboutsummaryrefslogtreecommitdiff
path: root/fabric/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-06-06 16:25:02 +0800
committershedaniel <daniel@shedaniel.me>2021-06-06 16:25:02 +0800
commit187aa4c0fc07dcf6a27f2edb83b3d8163bef7420 (patch)
treeefa24723245cff5a60d94ec2e151c6d24f15ca9a /fabric/src
parent0689696fe2639ea2f2de5fcfa1b6a42bf3d3ac8e (diff)
downloadRoughlyEnoughItems-187aa4c0fc07dcf6a27f2edb83b3d8163bef7420.tar.gz
RoughlyEnoughItems-187aa4c0fc07dcf6a27f2edb83b3d8163bef7420.tar.bz2
RoughlyEnoughItems-187aa4c0fc07dcf6a27f2edb83b3d8163bef7420.zip
Show gui for errors
Diffstat (limited to 'fabric/src')
-rw-r--r--fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
index 4e452bf16..5897f3864 100644
--- a/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
+++ b/fabric/src/main/java/me/shedaniel/rei/fabric/PluginDetectorImpl.java
@@ -24,6 +24,7 @@
package me.shedaniel.rei.fabric;
import com.google.common.collect.Iterables;
+import me.shedaniel.rei.RoughlyEnoughItemsState;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.common.plugins.*;
import net.fabricmc.api.EnvType;
@@ -36,7 +37,6 @@ import java.util.function.Consumer;
public class PluginDetectorImpl {
private static <P extends REIPlugin<?>> void loadPlugin(Class<? extends P> pluginClass, Consumer<? super REIPluginProvider<P>> consumer) {
- RuntimeException exception = null;
for (EntrypointContainer<REIPluginProvider> container : Iterables.concat(
FabricLoader.getInstance().getEntrypointContainers("rei_containers", REIPluginProvider.class),
FabricLoader.getInstance().getEntrypointContainers("rei_server", REIPluginProvider.class),
@@ -66,16 +66,17 @@ public class PluginDetectorImpl {
});
}
} catch (Throwable t) {
- if (exception == null) {
- exception = new RuntimeException("Could not create REI Plugin [" + pluginClass.getName() + "] due to errors, provided by '" + container.getProvider().getMetadata().getId() + "'!", t);
- } else {
- exception.addSuppressed(t);
- }
+ String error = "Could not create REI Plugin [" + getSimpleName(pluginClass) + "] due to errors, provided by '" + container.getProvider().getMetadata().getId() + "'!";
+ new RuntimeException(error, t).printStackTrace();
+ RoughlyEnoughItemsState.error(error);
}
}
- if (exception != null) {
- throw exception;
- }
+ }
+
+ private static <P> String getSimpleName(Class<? extends P> pluginClass) {
+ String simpleName = pluginClass.getSimpleName();
+ if (simpleName == null) return pluginClass.getName();
+ return simpleName;
}
public static void detectServerPlugins() {