summaryrefslogtreecommitdiffstats
path: root/neoforge/src
diff options
context:
space:
mode:
Diffstat (limited to 'neoforge/src')
-rw-r--r--neoforge/src/main/java/com/aizistral/nochatreports/loader/LoaderPaths.java17
-rw-r--r--neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java32
-rw-r--r--neoforge/src/main/resources/mixins/neoforge/nochatreports-neoforge.mixins.json1
3 files changed, 34 insertions, 16 deletions
diff --git a/neoforge/src/main/java/com/aizistral/nochatreports/loader/LoaderPaths.java b/neoforge/src/main/java/com/aizistral/nochatreports/loader/LoaderPaths.java
new file mode 100644
index 0000000..8f4e23a
--- /dev/null
+++ b/neoforge/src/main/java/com/aizistral/nochatreports/loader/LoaderPaths.java
@@ -0,0 +1,17 @@
+package com.aizistral.nochatreports.loader;
+
+import java.nio.file.Path;
+
+import net.neoforged.fml.loading.FMLPaths;
+
+public final class LoaderPaths {
+
+ private LoaderPaths() {
+ throw new IllegalStateException("Can't touch this");
+ }
+
+ public static Path getConfigDir() {
+ return FMLPaths.CONFIGDIR.get();
+ }
+
+}
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 680a74d..64e9da8 100644
--- a/neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java
+++ b/neoforge/src/main/java/com/aizistral/nochatreports/neoforge/NoChatReports.java
@@ -2,6 +2,7 @@ package com.aizistral.nochatreports.neoforge;
import com.aizistral.nochatreports.common.NCRClient;
import com.aizistral.nochatreports.common.NCRCore;
+import com.aizistral.nochatreports.common.config.NCRConfig;
import com.aizistral.nochatreports.common.platform.PlatformProvider;
import com.aizistral.nochatreports.common.platform.events.ClientEvents;
import net.minecraft.client.Minecraft;
@@ -10,12 +11,11 @@ import net.minecraft.client.multiplayer.ClientPacketListener;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
-import net.neoforged.bus.api.SubscribeEvent;
-import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
+import net.neoforged.neoforge.common.NeoForge;
import java.nio.file.Path;
import java.util.function.Function;
@@ -25,13 +25,20 @@ public class NoChatReports implements PlatformProvider {
public NoChatReports() {
NCRCore.awaken(this);
- Function<Screen, Screen> configScreenFactory = NCRClient.getConfigScreen();
- if (isOnClient() && configScreenFactory != null) {
- ModLoadingContext.get().registerExtensionPoint(
- IConfigScreenFactory.class,
- () -> (minecraft, parent) -> configScreenFactory.apply(parent)
- );
- }
+
+ if (NCRConfig.isModRunning() && this.isOnClient()) {
+ NeoForge.EVENT_BUS.addListener(ClientPlayerNetworkEvent.LoggingIn.class, Events::onPlayReady);
+ }
+
+ if (this.isOnClient()) {
+ Function<Screen, Screen> configScreenFactory = NCRClient.getConfigScreen();
+ if (configScreenFactory != null) {
+ ModLoadingContext.get().registerExtensionPoint(
+ IConfigScreenFactory.class,
+ () -> (minecraft, parent) -> configScreenFactory.apply(parent)
+ );
+ }
+ }
}
@Override
@@ -48,16 +55,9 @@ public class NoChatReports implements PlatformProvider {
public Path getMinecraftDir() {
return FMLPaths.GAMEDIR.get();
}
-
- @Override
- public Path getConfigDir() {
- return FMLPaths.CONFIGDIR.get();
- }
- @EventBusSubscriber(modid = "nochatreports", value = Dist.CLIENT)
public static class Events {
- @SubscribeEvent
public static void onPlayReady(ClientPlayerNetworkEvent.LoggingIn event) {
Minecraft client = Minecraft.getInstance();
ClientPacketListener handler = client.getConnection();
diff --git a/neoforge/src/main/resources/mixins/neoforge/nochatreports-neoforge.mixins.json b/neoforge/src/main/resources/mixins/neoforge/nochatreports-neoforge.mixins.json
index 67906d1..21489d9 100644
--- a/neoforge/src/main/resources/mixins/neoforge/nochatreports-neoforge.mixins.json
+++ b/neoforge/src/main/resources/mixins/neoforge/nochatreports-neoforge.mixins.json
@@ -2,6 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "com.aizistral.nochatreports.neoforge.mixins",
+ "plugin": "com.aizistral.nochatreports.common.NCRMixinPlugin",
"compatibilityLevel": "JAVA_21",
"mixins": [],
"client": [