11package org .polyfrost .colorsaturation .mixin ;
22
3+ //#if MC >= 11700
4+ //#if MC >= 12105
5+ //$$ import net.minecraft.client.renderer.GameRenderer;
6+ //#else
7+ //$$ import net.minecraft.client.renderer.GameRenderer;
8+ //$$ import com.mojang.blaze3d.systems.RenderSystem;
9+ //$$ import net.minecraft.client.renderer.PostChain;
10+ //#endif
11+ //#else
312import net .minecraft .client .renderer .EntityRenderer ;
413import net .minecraft .client .renderer .GlStateManager ;
514import net .minecraft .client .renderer .OpenGlHelper ;
615import net .minecraft .client .shader .ShaderGroup ;
16+ //#endif
17+
718import org .polyfrost .colorsaturation .EntityRendererHook ;
819import org .spongepowered .asm .mixin .Mixin ;
920import org .spongepowered .asm .mixin .Shadow ;
1324import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
1425import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
1526
27+ //#if MC >= 11700
28+ //$$ @Mixin(GameRenderer.class)
29+ //#else
1630@ Mixin (EntityRenderer .class )
31+ //#endif
1732public class EntityRendererMixin implements EntityRendererHook {
33+ //#if MC >= 11700
34+ //#if MC >= 12105
35+ //#else
36+ //$$ @Shadow
37+ //$$ private PostChain postEffect;
38+ //$$ @Unique
39+ //$$ private PostChain colorSaturation$saturationShader;
40+ //#endif
41+ //#else
1842 @ Shadow
1943 private ShaderGroup theShaderGroup ;
2044 @ Unique
2145 private ShaderGroup colorSaturation$saturationShader ;
46+ //#endif
2247
48+ //#if MC >= 11700
49+ //#if MC >= 12105
50+ //#else
51+ //$$ @Inject(method = "checkEntityPostEffect", at = @At("HEAD"), cancellable = true)
52+ //$$ private void onIsShaderActive(CallbackInfoReturnable<Boolean> cir) {
53+ //$$ if (colorSaturation$saturationShader != null) {
54+ //$$ cir.setReturnValue(true);
55+ //$$ }
56+ //$$ }
57+ //#endif
58+ //#else
2359 @ Inject (method = "isShaderActive" , at = @ At ("HEAD" ), cancellable = true )
2460 private void onIsShaderActive (CallbackInfoReturnable <Boolean > cir ) {
2561 if (colorSaturation$saturationShader != null && OpenGlHelper .shadersSupported ) {
2662 cir .setReturnValue (true );
2763 }
2864 }
65+ //#endif
2966
67+ //#if MC >= 11700
68+ //#if MC >= 12105
69+ //#else
70+ //$$ @Inject(method = "getPostEffect", at = @At("HEAD"), cancellable = true)
71+ //$$ private void onGetShaderGroup(CallbackInfoReturnable<PostChain> cir) {
72+ //$$ if (colorSaturation$saturationShader != null && this.postEffect == null) {
73+ //$$ cir.setReturnValue(colorSaturation$saturationShader);
74+ //$$ }
75+ //$$ }
76+ //#endif
77+ //#else
3078 @ Inject (method = "getShaderGroup" , at = @ At ("HEAD" ), cancellable = true )
3179 private void onGetShaderGroup (CallbackInfoReturnable <ShaderGroup > cir ) {
3280 if (colorSaturation$saturationShader != null && OpenGlHelper .shadersSupported && this .theShaderGroup == null ) {
3381 cir .setReturnValue (colorSaturation$saturationShader );
3482 }
3583 }
84+ //#endif
3685
86+ //#if MC >= 11700
87+ //#if MC >= 12105
88+ //#else
89+ //$$ @Inject(method = "resize", at = @At("TAIL"))
90+ //$$ private void updatePhosphor(int width, int height, CallbackInfo ci) {
91+ //$$ if (colorSaturation$saturationShader != null) {
92+ //$$ colorSaturation$saturationShader.resize(width, height);
93+ //$$ }
94+ //$$ }
95+ //#endif
96+ //#else
3797 @ Inject (method = "updateShaderGroupSize" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/renderer/RenderGlobal;createBindEntityOutlineFbs(II)V" ))
3898 private void updatePhosphor (int width , int height , CallbackInfo ci ) {
3999 if (colorSaturation$saturationShader != null ) {
40100 colorSaturation$saturationShader .createBindFramebuffers (width , height );
41101 }
42102 }
103+ //#endif
43104
105+ //#if MC >= 11700
106+ //#if MC >= 12105
107+ //#else
108+ //$$ @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderLevel(Lcom/mojang/blaze3d/vertex/PoseStack;FJZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lcom/mojang/math/Matrix4f;)V", shift = At.Shift.AFTER))
109+ //$$ private void renderPhosphor(float partialTicks, long nanoTime, boolean renderLevel, CallbackInfo ci) {
110+ //$$ if (this.colorSaturation$saturationShader != null) {
111+ //$$ this.colorSaturation$saturationShader.process(partialTicks);
112+ //$$ }
113+ //$$ }
114+ //#endif
115+ //#else
44116 @ Inject (method = "updateCameraAndRender" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/renderer/RenderGlobal;renderEntityOutlineFramebuffer()V" , shift = At .Shift .AFTER ))
45117 private void renderPhosphor (float partialTicks , long nanoTime , CallbackInfo ci ) {
46118 if (this .colorSaturation$saturationShader != null ) {
@@ -51,7 +123,22 @@ private void renderPhosphor(float partialTicks, long nanoTime, CallbackInfo ci)
51123 GlStateManager .popMatrix ();
52124 }
53125 }
126+ //#endif
54127
128+ //#if MC >= 11700
129+ //#if MC >= 12105
130+ //#else
131+ //$$ @Override
132+ //$$ public PostChain colorSaturation$getSaturationShader() {
133+ //$$ return colorSaturation$saturationShader;
134+ //$$ }
135+ //$$
136+ //$$ @Override
137+ //$$ public void colorSaturation$setSaturationShader(PostChain saturationShader) {
138+ //$$ this.colorSaturation$saturationShader = saturationShader;
139+ //$$ }
140+ //#endif
141+ //#else
55142 @ Override
56143 public ShaderGroup colorSaturation$getSaturationShader () {
57144 return colorSaturation$saturationShader ;
@@ -61,4 +148,5 @@ private void renderPhosphor(float partialTicks, long nanoTime, CallbackInfo ci)
61148 public void colorSaturation$setSaturationShader (ShaderGroup saturationShader ) {
62149 this .colorSaturation$saturationShader = saturationShader ;
63150 }
64- }
151+ //#endif
152+ }
0 commit comments