|
11 | 11 | import org.spongepowered.asm.mixin.Final; |
12 | 12 | import org.spongepowered.asm.mixin.Mixin; |
13 | 13 | import org.spongepowered.asm.mixin.Shadow; |
| 14 | +import org.spongepowered.asm.mixin.Unique; |
14 | 15 | import org.spongepowered.asm.mixin.injection.At; |
15 | 16 | import org.spongepowered.asm.mixin.injection.Inject; |
16 | 17 | import org.spongepowered.asm.mixin.injection.ModifyVariable; |
|
22 | 23 | @Mixin(GameRenderer.class) |
23 | 24 | public class GameRendererMixin |
24 | 25 | { |
25 | | - @Shadow |
26 | | - @Final |
27 | | - private Minecraft minecraft; |
| 26 | + @Unique |
| 27 | + private int controllable$captureMouseX; |
28 | 28 |
|
29 | | - /*@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/render/GuiRenderer;render(Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V")) |
30 | | - private void controllableLastRender(DeltaTracker tracker, boolean running, CallbackInfo ci, @Local GuiGraphics graphics) |
| 29 | + @Unique |
| 30 | + private int controllable$captureMouseY; |
| 31 | + |
| 32 | + @Unique |
| 33 | + private GuiGraphics controllable$graphics; |
| 34 | + |
| 35 | + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getOverlay()Lnet/minecraft/client/gui/screens/Overlay;", ordinal = 0)) |
| 36 | + private void captureLocals(DeltaTracker tracker, boolean p_109096_, CallbackInfo ci, @Local(ordinal = 0) int mouseX, @Local(ordinal = 1) int mouseY, @Local(ordinal = 0) GuiGraphics graphics) |
| 37 | + { |
| 38 | + this.controllable$captureMouseX = mouseX; |
| 39 | + this.controllable$captureMouseY = mouseY; |
| 40 | + this.controllable$graphics = graphics; |
| 41 | + } |
| 42 | + |
| 43 | + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/render/GuiRenderer;render(Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V")) |
| 44 | + private void renderOverlay(DeltaTracker tracker, boolean p_109096_, CallbackInfo ci) |
31 | 45 | { |
32 | | - int mouseX = (int) this.minecraft.mouseHandler.getScaledXPos(this.minecraft.getWindow()); |
33 | | - int mouseY = (int) this.minecraft.mouseHandler.getScaledYPos(this.minecraft.getWindow()); |
34 | | - OverlayRenderer.draw(graphics, mouseX, mouseY, tracker); |
35 | | - }*/ |
| 46 | + if(this.controllable$graphics != null) |
| 47 | + { |
| 48 | + OverlayRenderer.draw(this.controllable$graphics, this.controllable$captureMouseX, this.controllable$captureMouseY, tracker); |
| 49 | + this.controllable$graphics = null; |
| 50 | + } |
| 51 | + } |
36 | 52 |
|
37 | 53 | @ModifyVariable(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/CommandEncoder;clearDepthTexture(Lcom/mojang/blaze3d/textures/GpuTexture;D)V", remap = false, ordinal = 0), index = 4, ordinal = 0, require = 1) |
38 | 54 | private int controllableModifyMouseX(int original) |
|
0 commit comments