From 1010dd157c86179186fce067f82b8001b416af7d Mon Sep 17 00:00:00 2001 From: ACGaming <4818419+ACGaming@users.noreply.github.com> Date: Thu, 22 Aug 2024 11:19:13 +0200 Subject: [PATCH] Add Language Switching Speed OptiFine incompatibility warning Closes #514 --- .../mod/acgaming/universaltweaks/config/UTConfigTweaks.java | 6 +++++- .../languageswitching/mixin/UTLanguageListMixin.java | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 82283612..44c28f53 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -2070,7 +2070,11 @@ public static class PerformanceCategory @Config.RequiresMcRestart @Config.Name("Improve Language Switching Speed") - @Config.Comment("Improves the speed of switching languages in the Language GUI") + @Config.Comment + ({ + "Improves the speed of switching languages in the Language GUI", + "Incompatible with OptiFine" + }) public boolean utImproveLanguageSwitchingSpeed = true; @Config.RequiresMcRestart diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/languageswitching/mixin/UTLanguageListMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/languageswitching/mixin/UTLanguageListMixin.java index be1bec8c..4b68d6d6 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/languageswitching/mixin/UTLanguageListMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/languageswitching/mixin/UTLanguageListMixin.java @@ -5,6 +5,7 @@ import net.minecraftforge.fml.client.FMLClientHandler; import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import mod.acgaming.universaltweaks.core.UTLoadingPlugin; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -17,7 +18,7 @@ public abstract class UTLanguageListMixin @Redirect(method = "elementClicked", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;refreshResources([Lnet/minecraftforge/client/resource/IResourceType;)V", remap = false)) public void utImproveLanguageSwitchingPerformance(FMLClientHandler handler, IResourceType[] resources) { - if (!UTConfigTweaks.PERFORMANCE.utImproveLanguageSwitchingSpeed) return; + if (!UTConfigTweaks.PERFORMANCE.utImproveLanguageSwitchingSpeed || UTLoadingPlugin.optiFineLoaded) return; Minecraft mc = Minecraft.getMinecraft(); mc.getLanguageManager().onResourceManagerReload(mc.getResourceManager()); }