diff options
| author | Aizistral | 2026-11-19 03:31:54 +0100 |
|---|---|---|
| committer | Aizistral | 2026-11-19 03:31:54 +0100 |
| commit | e4dd37b5d8961a0286ccacbd1b0f6b47441f9b61 (patch) | |
| tree | ab122f088001b78d7f2af28b04ffb2640cbe20aa | |
| parent | e8055030f65c4b56fcd20f27760645056655701a (diff) | |
Register config screen only on client
| -rw-r--r-- | forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java | 20 | ||||
| -rw-r--r-- | neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java | 16 |
2 files changed, 20 insertions, 16 deletions
diff --git a/forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java b/forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java index 7730ee9..8c59459 100644 --- a/forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java +++ b/forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java @@ -30,15 +30,17 @@ public class NoChatReports implements PlatformProvider { ClientPlayerNetworkEvent.LoggingIn.BUS.addListener(Events::onPlayReady); } - Function<Screen, Screen> configScreenFactory = NCRClient.getConfigScreen(); - if (isOnClient() && configScreenFactory != null) { - context.registerExtensionPoint( - ConfigScreenHandler.ConfigScreenFactory.class, - () -> new ConfigScreenHandler.ConfigScreenFactory( - (minecraft, parent) -> configScreenFactory.apply(parent) - ) - ); - } + if (this.isOnClient()) { + Function<Screen, Screen> configScreenFactory = NCRClient.getConfigScreen(); + if (configScreenFactory != null) { + context.registerExtensionPoint( + ConfigScreenHandler.ConfigScreenFactory.class, + () -> new ConfigScreenHandler.ConfigScreenFactory( + (minecraft, parent) -> configScreenFactory.apply(parent) + ) + ); + } + } } @Override diff --git a/neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java b/neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java index 52c3657..64e9da8 100644 --- a/neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java +++ b/neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java @@ -30,13 +30,15 @@ public class NoChatReports implements PlatformProvider { NeoForge.EVENT_BUS.addListener(ClientPlayerNetworkEvent.LoggingIn.class, Events::onPlayReady); } - Function<Screen, Screen> configScreenFactory = NCRClient.getConfigScreen(); - if (isOnClient() && configScreenFactory != null) { - ModLoadingContext.get().registerExtensionPoint( - IConfigScreenFactory.class, - () -> (minecraft, parent) -> configScreenFactory.apply(parent) - ); - } + if (this.isOnClient()) { + Function<Screen, Screen> configScreenFactory = NCRClient.getConfigScreen(); + if (configScreenFactory != null) { + ModLoadingContext.get().registerExtensionPoint( + IConfigScreenFactory.class, + () -> (minecraft, parent) -> configScreenFactory.apply(parent) + ); + } + } } @Override |
