Skip to content

Commit

Permalink
Add Language Switching Speed OptiFine incompatibility warning
Browse files Browse the repository at this point in the history
Closes #514
  • Loading branch information
ACGaming committed Aug 22, 2024
1 parent 6e21cc4 commit 1010dd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
}
Expand Down

0 comments on commit 1010dd1

Please sign in to comment.