diff --git a/src/main/java/grondag/canvas/mixin/MixinAccessibilityOptionsScreen.java b/src/main/java/grondag/canvas/mixin/MixinAccessibilityOptionsScreen.java index 308d8f9d0..3d302a552 100644 --- a/src/main/java/grondag/canvas/mixin/MixinAccessibilityOptionsScreen.java +++ b/src/main/java/grondag/canvas/mixin/MixinAccessibilityOptionsScreen.java @@ -25,7 +25,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.client.Minecraft; import net.minecraft.client.OptionInstance; import net.minecraft.client.Options; import net.minecraft.client.gui.screens.AccessibilityOptionsScreen; @@ -33,7 +32,6 @@ import net.minecraft.client.gui.screens.SimpleOptionsSubScreen; import net.minecraft.network.chat.Component; -import grondag.canvas.apiimpl.CanvasState; import grondag.canvas.shader.data.AccessibilityData; @Mixin(AccessibilityOptionsScreen.class) @@ -44,18 +42,12 @@ public MixinAccessibilityOptionsScreen(Screen screen, Options options, Component @Inject(at = @At("HEAD"), method = "method_31384") void onClosing(CallbackInfo ci) { - canvas_onClose(); + AccessibilityData.onCloseOptionScreen(); } @Override public void onClose() { - canvas_onClose(); + AccessibilityData.onCloseOptionScreen(); super.onClose(); } - - private static void canvas_onClose() { - if (AccessibilityData.checkChanged() && Minecraft.getInstance().level != null) { - CanvasState.recompileIfNeeded(true); - } - } } diff --git a/src/main/java/grondag/canvas/mixin/MixinVideoSettingsScreen.java b/src/main/java/grondag/canvas/mixin/MixinVideoSettingsScreen.java index 0d1836bdb..35c237a27 100644 --- a/src/main/java/grondag/canvas/mixin/MixinVideoSettingsScreen.java +++ b/src/main/java/grondag/canvas/mixin/MixinVideoSettingsScreen.java @@ -29,6 +29,7 @@ import net.minecraft.client.gui.screens.VideoSettingsScreen; import net.minecraft.network.chat.Component; +import grondag.canvas.shader.data.AccessibilityData; import grondag.canvas.varia.CanvasButtonWidget; @Mixin(VideoSettingsScreen.class) @@ -41,4 +42,15 @@ public MixinVideoSettingsScreen(Component title) { private void onInit(CallbackInfo info) { CanvasButtonWidget.parent = this; } + + @Inject(at = @At("HEAD"), method = "method_19865") + void onClosing(CallbackInfo ci) { + AccessibilityData.onCloseOptionScreen(); + } + + @Override + public void onClose() { + AccessibilityData.onCloseOptionScreen(); + super.onClose(); + } } diff --git a/src/main/java/grondag/canvas/shader/data/AccessibilityData.java b/src/main/java/grondag/canvas/shader/data/AccessibilityData.java index 0239f6987..87c592916 100644 --- a/src/main/java/grondag/canvas/shader/data/AccessibilityData.java +++ b/src/main/java/grondag/canvas/shader/data/AccessibilityData.java @@ -23,6 +23,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; +import grondag.canvas.apiimpl.CanvasState; + public class AccessibilityData { static final ResourceLocation id = new ResourceLocation("canvas:accessibility"); @@ -37,6 +39,12 @@ public class AccessibilityData { static String cache = null; + public static void onCloseOptionScreen() { + if (AccessibilityData.checkChanged() && Minecraft.getInstance().level != null) { + CanvasState.recompileIfNeeded(true); + } + } + public static boolean checkChanged() { final var mc = Minecraft.getInstance();