7
7
*/
8
8
package net .wurstclient .mixin ;
9
9
10
+ import org .joml .Matrix4f ;
10
11
import org .objectweb .asm .Opcodes ;
11
12
import org .spongepowered .asm .mixin .Mixin ;
12
13
import org .spongepowered .asm .mixin .injection .At ;
13
14
import org .spongepowered .asm .mixin .injection .Inject ;
14
- import org .spongepowered .asm .mixin .injection .Redirect ;
15
15
import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
16
16
import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
17
17
18
18
import com .llamalad7 .mixinextras .injector .wrapoperation .Operation ;
19
19
import com .llamalad7 .mixinextras .injector .wrapoperation .WrapOperation ;
20
+ import com .llamalad7 .mixinextras .sugar .Local ;
20
21
21
22
import net .minecraft .client .render .Camera ;
22
23
import net .minecraft .client .render .GameRenderer ;
23
24
import net .minecraft .client .util .math .MatrixStack ;
24
25
import net .minecraft .entity .Entity ;
25
26
import net .minecraft .entity .LivingEntity ;
26
27
import net .minecraft .util .hit .HitResult ;
27
- import net .minecraft .util .math .MathHelper ;
28
28
import net .wurstclient .WurstClient ;
29
29
import net .wurstclient .event .EventManager ;
30
30
import net .wurstclient .events .CameraTransformViewBobbingListener .CameraTransformViewBobbingEvent ;
@@ -42,10 +42,9 @@ public abstract class GameRendererMixin implements AutoCloseable
42
42
*/
43
43
@ Inject (at = @ At (value = "INVOKE" ,
44
44
target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V" ,
45
- ordinal = 0 ),
46
- method = "renderWorld(FJLnet/minecraft/client/util/math/MatrixStack;)V" )
45
+ ordinal = 0 ), method = "renderWorld(FJ)V" )
47
46
private void onRenderWorldViewBobbing (float tickDelta , long limitTime ,
48
- MatrixStack matrices , CallbackInfo ci )
47
+ CallbackInfo ci )
49
48
{
50
49
CameraTransformViewBobbingEvent event =
51
50
new CameraTransformViewBobbingEvent ();
@@ -78,9 +77,8 @@ private void onBobView(MatrixStack matrices, float tickDelta,
78
77
* after the view-bobbing call.
79
78
*/
80
79
@ Inject (at = @ At ("HEAD" ),
81
- method = "renderHand(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/Camera;F)V" )
82
- private void onRenderHand (MatrixStack matrices , Camera camera ,
83
- float tickDelta , CallbackInfo ci )
80
+ method = "renderHand(Lnet/minecraft/client/render/Camera;F)V" )
81
+ private void onRenderHand (Camera camera , float tickDelta , CallbackInfo ci )
84
82
{
85
83
cancelNextBobView = false ;
86
84
}
@@ -90,11 +88,13 @@ private void onRenderHand(MatrixStack matrices, Camera camera,
90
88
target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z" ,
91
89
opcode = Opcodes .GETFIELD ,
92
90
ordinal = 0 ),
93
- method = "renderWorld(FJLnet/minecraft/client/util/math/MatrixStack; )V" )
94
- private void onRenderWorld (float tickDelta , long limitTime ,
95
- MatrixStack matrices , CallbackInfo ci )
91
+ method = "renderWorld(FJ )V" )
92
+ private void onRenderWorld (float tickDelta , long limitTime , CallbackInfo ci ,
93
+ @ Local ( ordinal = 1 ) Matrix4f matrix4f2 )
96
94
{
97
- RenderEvent event = new RenderEvent (matrices , tickDelta );
95
+ MatrixStack matrixStack = new MatrixStack ();
96
+ matrixStack .multiplyPositionMatrix (matrix4f2 );
97
+ RenderEvent event = new RenderEvent (matrixStack , tickDelta );
98
98
EventManager .fire (event );
99
99
}
100
100
@@ -125,15 +125,16 @@ private HitResult liquidsRaycast(Entity instance, double maxDistance,
125
125
return original .call (instance , maxDistance , tickDelta , true );
126
126
}
127
127
128
- @ Redirect (
128
+ @ WrapOperation (
129
129
at = @ At (value = "INVOKE" ,
130
130
target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F" ,
131
131
ordinal = 0 ),
132
- method = "renderWorld(FJLnet/minecraft/client/util/math/MatrixStack;)V" )
133
- private float wurstNauseaLerp (float delta , float start , float end )
132
+ method = "renderWorld(FJ)V" )
133
+ private float wurstNauseaLerp (float delta , float start , float end ,
134
+ Operation <Float > original )
134
135
{
135
136
if (!WurstClient .INSTANCE .getHax ().antiWobbleHack .isEnabled ())
136
- return MathHelper . lerp (delta , start , end );
137
+ return original . call (delta , start , end );
137
138
138
139
return 0 ;
139
140
}
0 commit comments