Skip to content

Commit da96ffa

Browse files
committed
[Loader] IFMLLoadingExceptionListener service
1 parent 7e89316 commit da96ffa

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package pl.olafcio.avoid_loader.interfaces.services.stage.fml;
2+
3+
/**
4+
* A service that gets loaded when a loading exception gets added on Forge.<br/>
5+
* This is after Avoid Loader.
6+
* <br/><br/>
7+
* <b>NOTE:</b> This currently doesn't get fired on NeoForge because, guess what!<br/>&emsp;&emsp;&emsp;&ensp;I'd have to use Unsafe!
8+
* <br/><br/>
9+
* <pre>
10+
* {@code
11+
* private static final List<ModLoadingIssue> loadingIssues = new ArrayList<>();
12+
* }
13+
* </pre>
14+
* <br/>
15+
* Thank their excellent feature breaking team for this amazing... "feature"! Of breaking reflection!
16+
*
17+
* @service
18+
*/
19+
public interface IFMLLoadingExceptionListener {
20+
void acknowledge(Exception e);
21+
}

‎versions/forge/java/pl/olafcio/avoid_platform/PlatformFatalImpl.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ public void load() {
3333
private Optional<Consumer<String>> make(Consumer<String> delegate) {
3434
return Optional.of(t -> {
3535
if (t.equals("ERROR DURING MOD LOADING") && !Reflect.get(ModLoader.class, "loadingStateValid", boolean.class, ModLoader.get())) {
36-
PreModLoader.getInstance().loadService(IFMLCowardlyEventStateListener.class);
36+
var services = PreModLoader.getInstance().loadService(IFMLCowardlyEventStateListener.class);
37+
38+
for (var service : services)
39+
service.acknowledge();
3740
}
3841

3942
if (delegate != null)

0 commit comments

Comments
 (0)