summaryrefslogtreecommitdiffstats
path: root/forge
diff options
context:
space:
mode:
Diffstat (limited to 'forge')
-rw-r--r--forge/build.gradle6
-rw-r--r--forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java15
-rw-r--r--forge/src/main/java/com/aizistral/nochatreports/loader/LoaderPaths.java17
-rw-r--r--forge/src/main/resources/mixins/forge/nochatreports-forge.mixins.json1
4 files changed, 26 insertions, 13 deletions
diff --git a/forge/build.gradle b/forge/build.gradle
index 1a4511d..32ad301 100644
--- a/forge/build.gradle
+++ b/forge/build.gradle
@@ -136,9 +136,9 @@ jar {
attributes([
"Specification-Title": "${mod_name}",
"Specification-Vendor": "${mod_author}",
- "Specification-Version": "${version}",
+ "Specification-Version": "${manifest_version}",
"Implementation-Title": "${mod_name}",
- "Implementation-Version": "${version}",
+ "Implementation-Version": "${manifest_version}",
"Implementation-Vendor" :"${mod_author}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "mixins/common/nochatreports.mixins.json, mixins/forge/nochatreports-forge.mixins.json"
@@ -157,7 +157,7 @@ processResources {
// Replace properties in mods.toml with ones derived from settings.gradle
include 'mods.toml'
expand 'mod_license': mod_license,
- 'mod_version': version,
+ 'mod_version': manifest_version,
'mod_id' : mod_id,
'mod_name': mod_name,
'mod_url': mod_url,
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 3b13d49..60a5f0e 100644
--- a/forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java
+++ b/forge/src/main/java/com/aizistral/nochatreports/forge/NoChatReports.java
@@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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;
@@ -24,11 +25,8 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
-import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
-import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
@@ -48,6 +46,10 @@ public class NoChatReports implements PlatformProvider {
public NoChatReports() {
NCRCore.awaken(this);
+
+ if (NCRConfig.isModRunning() && this.isOnClient()) {
+ MinecraftForge.EVENT_BUS.addListener(Events::onPlayReady);
+ }
}
@Override
@@ -64,16 +66,9 @@ public class NoChatReports implements PlatformProvider {
public Path getMinecraftDir() {
return FMLPaths.GAMEDIR.get();
}
-
- @Override
- public Path getConfigDir() {
- return FMLPaths.CONFIGDIR.get();
- }
- @EventBusSubscriber(modid = "nochatreports", bus = Bus.FORGE)
public static class Events {
- @SubscribeEvent
@OnlyIn(Dist.CLIENT)
public static void onPlayReady(ClientPlayerNetworkEvent.LoggingIn event) {
Minecraft client = Minecraft.getInstance();
diff --git a/forge/src/main/java/com/aizistral/nochatreports/loader/LoaderPaths.java b/forge/src/main/java/com/aizistral/nochatreports/loader/LoaderPaths.java
new file mode 100644
index 0000000..751f952
--- /dev/null
+++ b/forge/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.minecraftforge.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/forge/src/main/resources/mixins/forge/nochatreports-forge.mixins.json b/forge/src/main/resources/mixins/forge/nochatreports-forge.mixins.json
index e91062c..b368306 100644
--- a/forge/src/main/resources/mixins/forge/nochatreports-forge.mixins.json
+++ b/forge/src/main/resources/mixins/forge/nochatreports-forge.mixins.json
@@ -2,6 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "com.aizistral.nochatreports.forge.mixins",
+ "plugin": "com.aizistral.nochatreports.common.NCRMixinPlugin",
"compatibilityLevel": "JAVA_17",
"verbose": true,
"mixins": [],