1+ package me .modmuss50 .optifabric .compat .architectury .mixin ;
2+
3+ import me .modmuss50 .optifabric .compat .InterceptingMixin ;
4+ import me .modmuss50 .optifabric .compat .PlacatingSurrogate ;
5+ import me .modmuss50 .optifabric .compat .Shim ;
6+ import net .minecraft .client .gui .DrawableHelper ;
7+ import net .minecraft .client .render .GameRenderer ;
8+ import net .minecraft .client .util .Window ;
9+ import net .minecraft .client .util .math .MatrixStack ;
10+ import org .joml .Matrix4f ;
11+ import org .spongepowered .asm .mixin .Mixin ;
12+ import org .spongepowered .asm .mixin .injection .At ;
13+ import org .spongepowered .asm .mixin .injection .At .Shift ;
14+ import org .spongepowered .asm .mixin .injection .Inject ;
15+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
16+ import org .spongepowered .asm .mixin .injection .callback .LocalCapture ;
17+
18+ @ Mixin (GameRenderer .class )
19+ @ InterceptingMixin ("dev/architectury/mixin/fabric/client/MixinGameRenderer" )
20+ abstract class GameRendererNew4erMixin {
21+ @ Shim
22+ private native void renderScreenPre (float tickDelta , long startTime , boolean tick , CallbackInfo ci , int mouseX , int mouseY , Window window , Matrix4f matrix , MatrixStack matrices , DrawableHelper drawContext );
23+
24+ @ PlacatingSurrogate
25+ private void renderScreenPre (float tickDelta , long startTime , boolean tick , CallbackInfo ci , int mouseX , int mouseY , Window window , float guiFarPlane , Matrix4f matrix , MatrixStack matrices ) {
26+ }
27+
28+ @ Inject (method = "render(FJZ)V" , locals = LocalCapture .CAPTURE_FAILHARD , cancellable = true ,
29+ at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/class_332;IIF)V" , ordinal = 0 ))
30+ private void renderScreenPre (float tickDelta , long startTime , boolean tick , CallbackInfo ci , int mouseX , int mouseY , Window window , float guiFarPlane , Matrix4f matrix , MatrixStack matrices , float idk , DrawableHelper drawContext ) {
31+ renderScreenPre (tickDelta , startTime , tick , ci , mouseX , mouseY , window , matrix , matrices , drawContext );
32+ }
33+
34+ @ Shim
35+ private native void renderScreenPost (float tickDelta , long startTime , boolean tick , CallbackInfo ci , int mouseX , int mouseY , Window window , Matrix4f matrix , MatrixStack matrices , DrawableHelper drawContext );
36+
37+ @ PlacatingSurrogate
38+ private void renderScreenPost (float tickDelta , long startTime , boolean tick , CallbackInfo ci , int mouseX , int mouseY , Window window , float guiFarPlane , Matrix4f matrix , MatrixStack matrices ) {
39+ }
40+
41+ @ Inject (method = "render(FJZ)V" , locals = LocalCapture .CAPTURE_FAILHARD ,
42+ at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/class_332;IIF)V" , shift = Shift .AFTER , ordinal = 0 ))
43+ private void renderScreenPost (float tickDelta , long startTime , boolean tick , CallbackInfo ci , int mouseX , int mouseY , Window window , float guiFarPlane , Matrix4f matrix , MatrixStack matrices , float idk , DrawableHelper drawContext ) {
44+ renderScreenPost (tickDelta , startTime , tick , ci , mouseX , mouseY , window , matrix , matrices , drawContext );
45+ }
46+ }
0 commit comments