|
17 | 17 |
|
18 | 18 | package com.lambda.mixin.render; |
19 | 19 |
|
| 20 | +import com.lambda.Lambda; |
20 | 21 | import com.lambda.event.EventFlow; |
21 | 22 | import com.lambda.event.events.RenderEvent; |
22 | 23 | import com.lambda.graphics.RenderMain; |
|
26 | 27 | import com.lambda.module.modules.render.Bobbing; |
27 | 28 | import com.lambda.module.modules.render.NoRender; |
28 | 29 | import com.lambda.module.modules.render.Zoom; |
| 30 | +import com.lambda.util.render.CursorOverrideProvider; |
29 | 31 | import com.llamalad7.mixinextras.injector.ModifyExpressionValue; |
30 | 32 | import com.llamalad7.mixinextras.injector.ModifyReturnValue; |
31 | 33 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
32 | 34 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; |
33 | 35 | import com.mojang.blaze3d.buffers.GpuBufferSlice; |
| 36 | +import net.minecraft.client.gui.DrawContext; |
| 37 | +import net.minecraft.client.gui.cursor.Cursor; |
34 | 38 | import net.minecraft.client.render.Camera; |
35 | 39 | import net.minecraft.client.render.GameRenderer; |
36 | 40 | import net.minecraft.client.render.RenderTickCounter; |
37 | 41 | import net.minecraft.client.render.WorldRenderer; |
38 | 42 | import net.minecraft.client.render.command.OrderedRenderCommandQueueImpl; |
| 43 | +import net.minecraft.client.util.Window; |
39 | 44 | import net.minecraft.client.util.ObjectAllocator; |
40 | 45 | import net.minecraft.item.ItemStack; |
41 | 46 | import org.joml.Matrix4f; |
@@ -89,6 +94,23 @@ private void onGuiRenderComplete(RenderTickCounter tickCounter, boolean tick, Ca |
89 | 94 | DearImGui.INSTANCE.render(); |
90 | 95 | } |
91 | 96 |
|
| 97 | + @WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;applyCursorTo(Lnet/minecraft/client/util/Window;)V")) |
| 98 | + private void applyCursorOverride(DrawContext context, Window window, Operation<Void> original) { |
| 99 | + original.call(context, window); |
| 100 | + |
| 101 | + if (Lambda.getMc().currentScreen instanceof CursorOverrideProvider provider) { |
| 102 | + int mouseX = (int) Lambda.getMc().mouse.getScaledX(window); |
| 103 | + int mouseY = (int) Lambda.getMc().mouse.getScaledY(window); |
| 104 | + Cursor cursor = provider.getCursorOverride(mouseX, mouseY); |
| 105 | + |
| 106 | + if (cursor != null) { |
| 107 | + cursor.applyTo(window); |
| 108 | + return; |
| 109 | + } |
| 110 | + } |
| 111 | + Cursor.DEFAULT.applyTo(window); |
| 112 | + } |
| 113 | + |
92 | 114 | @Inject(method = "shouldRenderBlockOutline()Z", at = @At("HEAD"), cancellable = true) |
93 | 115 | private void injectShouldRenderBlockOutline(CallbackInfoReturnable<Boolean> cir) { |
94 | 116 | if (BlockOutline.INSTANCE.isEnabled()) cir.setReturnValue(false); |
|
0 commit comments