From dac51a9eea0b2d78b8c320996ec9b40fb307370d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 11 Aug 2024 09:54:54 -0500 Subject: [PATCH] Add mod compat warning message config --- .../core/api/internal/ClientApi.java | 26 +++++++++++-------- .../distanthorizons/core/config/Config.java | 7 +++++ .../assets/distanthorizons/lang/en_us.json | 2 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java index 355396630..691d50870 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java @@ -497,7 +497,7 @@ public class ClientApi { // logging // - this.sendChatMessagesNow(); + this.sendQueuedChatMessages(); IProfilerWrapper profiler = MC.getProfiler(); profiler.pop(); // get out of "terrain" @@ -660,7 +660,7 @@ public class ClientApi } } - private void sendChatMessagesNow() + private void sendQueuedChatMessages() { // dev build if (ModInfo.IS_DEV_BUILD && !this.configOverrideReminderPrinted && MC.playerExists()) @@ -668,10 +668,12 @@ public class ClientApi this.configOverrideReminderPrinted = true; // remind the user that this is a development build - MC.sendChatMessage("\u00A72" + "Distant Horizons: nightly/unstable build, version: [" + ModInfo.VERSION+"]." + "\u00A7r"); - MC.sendChatMessage("Issues may occur with this version."); - MC.sendChatMessage("Here be dragons!"); - MC.sendChatMessage(""); + String message = + // green text + "\u00A72" + "Distant Horizons: nightly/unstable build, version: [" + ModInfo.VERSION+"]." + "\u00A7r\n" + + "Issues may occur with this version.\n" + + "Here be dragons!\n"; + MC.sendChatMessage(message); } // memory @@ -686,11 +688,13 @@ public class ClientApi long maxMemoryInBytes = Runtime.getRuntime().maxMemory(); if (maxMemoryInBytes < minimumRecommendedMemoryInBytes) { - MC.sendChatMessage("\u00A76" + "Distant Horizons: Low memory detected." + "\u00A7r"); - MC.sendChatMessage("Stuttering or low FPS may occur."); - MC.sendChatMessage("Please increase Minecraft's available memory to 4 gigabytes."); - MC.sendChatMessage("This warning can be disabled in DH's config under Advanced -> Logging."); - MC.sendChatMessage(""); + String message = + // orange text + "\u00A76" + "Distant Horizons: Low memory detected." + "\u00A7r \n" + + "Stuttering or low FPS may occur. \n" + + "Please increase Minecraft's available memory to 4 gigabytes. \n" + + "This warning can be disabled in DH's config under Advanced -> Logging. \n"; + MC.sendChatMessage(message); } } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index 463ebcbea..1479640cb 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -1179,6 +1179,13 @@ public class Config + "giving some basic information about how DH will function.") .build(); + public static ConfigEntry showModCompatibilityWarningsOnStartup = new ConfigEntry.Builder() + .set(true) + .comment("" + + "If enabled, a chat message will be displayed when a potentially problematic \n" + + "mod is installed alongside DH.") + .build(); + } public static class Debugging diff --git a/core/src/main/resources/assets/distanthorizons/lang/en_us.json b/core/src/main/resources/assets/distanthorizons/lang/en_us.json index 6399f811a..010226db5 100644 --- a/core/src/main/resources/assets/distanthorizons/lang/en_us.json +++ b/core/src/main/resources/assets/distanthorizons/lang/en_us.json @@ -566,6 +566,8 @@ "Show Low Memory Warning", "distanthorizons.config.client.advanced.logging.showReplayWarningOnStartup": "Show Replay Warning", + "distanthorizons.config.client.advanced.logging.showModCompatibilityWarningsOnStartup": + "Show Mod Compatibility Warnings",