diff --git a/build.gradle.kts b/build.gradle.kts index 09a5f02..d1a6c90 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -76,7 +76,9 @@ val modShade: Configuration by configurations.creating { // Configures the output directory for when building from the `src/resources` directory. sourceSets { + val dummy by creating main { + compileClasspath += dummy.output output.setResourcesDir(java.classesDirectory) } } diff --git a/src/dummy/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java b/src/dummy/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java new file mode 100644 index 0000000..cdb08b8 --- /dev/null +++ b/src/dummy/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java @@ -0,0 +1,4 @@ +package cc.polyfrost.oneconfig.internal.gui.impl; + +public class BlurHandlerImpl { +} diff --git a/src/main/java/org/polyfrost/colorsaturation/mixin/BlurHandlerImplMixin.java b/src/main/java/org/polyfrost/colorsaturation/mixin/BlurHandlerImplMixin.java new file mode 100644 index 0000000..d937547 --- /dev/null +++ b/src/main/java/org/polyfrost/colorsaturation/mixin/BlurHandlerImplMixin.java @@ -0,0 +1,34 @@ +package org.polyfrost.colorsaturation.mixin; + +import cc.polyfrost.oneconfig.internal.gui.impl.BlurHandlerImpl; +import cc.polyfrost.oneconfig.libs.universal.UMinecraft; +import org.polyfrost.colorsaturation.EntityRendererHook; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Pseudo +@Mixin(targets = "cc.polyfrost.oneconfig.internal.gui.impl.BlurHandlerImpl", remap = false) +public abstract class BlurHandlerImplMixin { + + @Shadow abstract boolean isShaderActive(); + + @Dynamic("OneConfig") + @Redirect(method = "reloadBlur", at = @At(value = "INVOKE", target = "Lcc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl;isShaderActive()Z", ordinal = 0)) + private boolean redirectShaderActive(BlurHandlerImpl a) { // works without any params in 0.7.11 but in 0.8 things got stricter + if ( + //#if MC<=11202 + net.minecraft.client.renderer.OpenGlHelper.shadersSupported + //#else + //$$ true + //#endif + && ((EntityRendererHook) UMinecraft.getMinecraft().entityRenderer).colorSaturation$getSaturationShader() != null + ) { + return false; + } + return isShaderActive(); + } +} \ No newline at end of file diff --git a/src/main/java/org/polyfrost/colorsaturation/mixin/BlurModMixin.java b/src/main/java/org/polyfrost/colorsaturation/mixin/BlurModMixin.java new file mode 100644 index 0000000..831dec8 --- /dev/null +++ b/src/main/java/org/polyfrost/colorsaturation/mixin/BlurModMixin.java @@ -0,0 +1,30 @@ +package org.polyfrost.colorsaturation.mixin; + +import cc.polyfrost.oneconfig.libs.universal.UMinecraft; +import net.minecraft.client.renderer.EntityRenderer; +import org.polyfrost.colorsaturation.EntityRendererHook; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Pseudo +@Mixin(targets = "com.tterrag.blur.Blur", remap = false) +public class BlurModMixin { + @Dynamic("Blur Mod") + @Redirect(method = "onGuiChange", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;isShaderActive()Z", ordinal = 0, remap = true), remap = false) + private boolean isShaderActive(EntityRenderer er) { + if ( + //#if MC<=11202 + net.minecraft.client.renderer.OpenGlHelper.shadersSupported + //#else + //$$ true + //#endif + && ((EntityRendererHook) UMinecraft.getMinecraft().entityRenderer).colorSaturation$getSaturationShader() != null + ) { + return false; + } + return er.isShaderActive(); + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.colorsaturation.json b/src/main/resources/mixins.colorsaturation.json index d97b243..c2e7532 100644 --- a/src/main/resources/mixins.colorsaturation.json +++ b/src/main/resources/mixins.colorsaturation.json @@ -7,6 +7,8 @@ "maxShiftBy": 5 }, "client": [ + "BlurHandlerImplMixin", + "BlurModMixin", "EntityRendererMixin", "OptifineConfigMixin", "ShaderGroupAccessor"