1
1
package net .coderbot .iris .mixin ;
2
2
3
+ import net .irisshaders .iris .api .v0 .IrisApi ;
3
4
import org .spongepowered .asm .mixin .Mixin ;
4
5
import org .spongepowered .asm .mixin .Unique ;
5
6
import org .spongepowered .asm .mixin .injection .At ;
@@ -27,10 +28,20 @@ public class MixinModelViewBobbing {
27
28
@ Unique
28
29
private Matrix4f bobbingEffectsModel ;
29
30
31
+ @ Unique
32
+ private boolean areShadersOn ;
33
+
34
+ @ Inject (method = "renderLevel" , at = @ At ("HEAD" ))
35
+ private void iris$saveShadersOn (float pGameRenderer0 , long pLong1 , PoseStack pPoseStack2 , CallbackInfo ci ) {
36
+ areShadersOn = IrisApi .getInstance ().isShaderPackInUse ();
37
+ }
38
+
30
39
@ ModifyArg (method = "renderLevel" , index = 0 ,
31
40
at = @ At (value = "INVOKE" ,
32
41
target = "Lnet/minecraft/client/renderer/GameRenderer;bobHurt(Lcom/mojang/blaze3d/vertex/PoseStack;F)V" ))
33
42
private PoseStack iris$separateViewBobbing (PoseStack stack ) {
43
+ if (!areShadersOn ) return stack ;
44
+
34
45
stack .pushPose ();
35
46
stack .last ().pose ().setIdentity ();
36
47
@@ -43,6 +54,8 @@ public class MixinModelViewBobbing {
43
54
slice = @ Slice (from = @ At (value = "INVOKE" ,
44
55
target = "Lnet/minecraft/client/renderer/GameRenderer;bobHurt(Lcom/mojang/blaze3d/vertex/PoseStack;F)V" )))
45
56
private PoseStack .Pose iris$saveBobbing (PoseStack stack ) {
57
+ if (!areShadersOn ) return stack .last ();
58
+
46
59
bobbingEffectsModel = stack .last ().pose ().copy ();
47
60
48
61
stack .popPose ();
@@ -54,6 +67,8 @@ public class MixinModelViewBobbing {
54
67
at = @ At (value = "INVOKE" ,
55
68
target = "Lnet/minecraft/client/renderer/GameRenderer;resetProjectionMatrix(Lcom/mojang/math/Matrix4f;)V" ))
56
69
private void iris$applyBobbingToModelView (float tickDelta , long limitTime , PoseStack matrix , CallbackInfo ci ) {
70
+ if (!areShadersOn ) return ;
71
+
57
72
matrix .last ().pose ().multiply (bobbingEffectsModel );
58
73
59
74
bobbingEffectsModel = null ;
0 commit comments