diff --git a/fabric/src/main/java/icyllis/modernui/mc/Config.java b/fabric/src/main/java/icyllis/modernui/mc/Config.java index adf97c26..9c5c7ca6 100644 --- a/fabric/src/main/java/icyllis/modernui/mc/Config.java +++ b/fabric/src/main/java/icyllis/modernui/mc/Config.java @@ -292,7 +292,7 @@ private Client(@Nonnull ForgeConfigSpec.Builder builder) { mTooltip = builder.comment( "Whether to enable Modern UI enhanced tooltip, or back to vanilla default.") - .define("enable", true); + .define("enable", !ModernUIMod.isSodiumLoaded() && !ModernUIMod.isLegendaryTooltipsLoaded()); mRoundedTooltip = builder.comment( "Whether to use rounded tooltip shapes, or to use rectangular shapes.") .define("roundedShape", true); diff --git a/fabric/src/main/java/icyllis/modernui/mc/ModernUIMod.java b/fabric/src/main/java/icyllis/modernui/mc/ModernUIMod.java index 482b55ce..eaf9878d 100644 --- a/fabric/src/main/java/icyllis/modernui/mc/ModernUIMod.java +++ b/fabric/src/main/java/icyllis/modernui/mc/ModernUIMod.java @@ -53,8 +53,10 @@ public abstract class ModernUIMod { public static volatile boolean sDevelopment; public static volatile boolean sDeveloperMode; - public static boolean sOptiFineLoaded; - public static boolean sIrisApiLoaded; + protected static boolean sOptiFineLoaded; + protected static boolean sIrisApiLoaded; + protected static volatile boolean sLegendaryTooltipsLoaded; + protected static volatile boolean sSodiumLoaded; static { try { @@ -89,6 +91,14 @@ public static boolean isIrisApiLoaded() { return sIrisApiLoaded; } + public static boolean isLegendaryTooltipsLoaded() { + return sLegendaryTooltipsLoaded; + } + + public static boolean isSodiumLoaded() { + return sSodiumLoaded; + } + public static boolean isDeveloperMode() { return sDeveloperMode || sDevelopment; } diff --git a/fabric/src/main/java/icyllis/modernui/mc/fabric/ModernUIFabric.java b/fabric/src/main/java/icyllis/modernui/mc/fabric/ModernUIFabric.java index bfcb83c2..25ed5925 100644 --- a/fabric/src/main/java/icyllis/modernui/mc/fabric/ModernUIFabric.java +++ b/fabric/src/main/java/icyllis/modernui/mc/fabric/ModernUIFabric.java @@ -41,6 +41,9 @@ public void onInitialize() { LOGGER.warn(MARKER, "Signature is missing"); } + sLegendaryTooltipsLoaded = FabricLoader.getInstance().isModLoaded("legendarytooltips"); + sSodiumLoaded = FabricLoader.getInstance().isModLoaded("sodium"); + ModConfigEvents.loading(ID).register(Config::reloadCommon); ModConfigEvents.reloading(ID).register(Config::reloadCommon); Config.initCommonConfig( diff --git a/forge/src/main/java/icyllis/modernui/mc/Config.java b/forge/src/main/java/icyllis/modernui/mc/Config.java index acd61f76..32cac25e 100644 --- a/forge/src/main/java/icyllis/modernui/mc/Config.java +++ b/forge/src/main/java/icyllis/modernui/mc/Config.java @@ -293,7 +293,7 @@ private Client(@Nonnull ForgeConfigSpec.Builder builder) { mTooltip = builder.comment( "Whether to enable Modern UI enhanced tooltip, or back to vanilla default.") - .define("enable", true); + .define("enable", !ModernUIMod.isLegendaryTooltipsLoaded()); mRoundedTooltip = builder.comment( "Whether to use rounded tooltip shapes, or to use rectangular shapes.") .define("roundedShape", true); diff --git a/forge/src/main/java/icyllis/modernui/mc/ModernUIMod.java b/forge/src/main/java/icyllis/modernui/mc/ModernUIMod.java index 0bad280a..2c980968 100644 --- a/forge/src/main/java/icyllis/modernui/mc/ModernUIMod.java +++ b/forge/src/main/java/icyllis/modernui/mc/ModernUIMod.java @@ -40,8 +40,9 @@ public abstract class ModernUIMod { public static volatile boolean sDevelopment; public static volatile boolean sDeveloperMode; - public static boolean sOptiFineLoaded; - public static boolean sIrisApiLoaded; + protected static boolean sOptiFineLoaded; + protected static boolean sIrisApiLoaded; + protected static volatile boolean sLegendaryTooltipsLoaded; static { try { @@ -76,6 +77,10 @@ public static boolean isIrisApiLoaded() { return sIrisApiLoaded; } + public static boolean isLegendaryTooltipsLoaded() { + return sLegendaryTooltipsLoaded; + } + public static boolean isDeveloperMode() { return sDeveloperMode || sDevelopment; } diff --git a/forge/src/main/java/icyllis/modernui/mc/forge/ModernUIForge.java b/forge/src/main/java/icyllis/modernui/mc/forge/ModernUIForge.java index 760f5a61..bbbb28d9 100644 --- a/forge/src/main/java/icyllis/modernui/mc/forge/ModernUIForge.java +++ b/forge/src/main/java/icyllis/modernui/mc/forge/ModernUIForge.java @@ -81,6 +81,7 @@ public ModernUIForge() { warnSetup("You should remove ReBlurred, Modern UI already includes its features, " + "and Modern UI has better performance than it"); } + sLegendaryTooltipsLoaded = ModList.get().isLoaded("legendarytooltips"); Config.initCommonConfig( spec -> ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, spec,