generated from Polyfrost/OneConfigExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/dummy/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package cc.polyfrost.oneconfig.internal.gui.impl; | ||
|
||
public class BlurHandlerImpl { | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/org/polyfrost/colorsaturation/mixin/BlurHandlerImplMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/org/polyfrost/colorsaturation/mixin/BlurModMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters