1919
2020import com .lambda .event .EventFlow ;
2121import com .lambda .event .events .RenderEvent ;
22+ import com .lambda .graphics .RenderMain ;
2223import com .lambda .gui .DearImGui ;
2324import com .lambda .gui .LambdaScreen ;
2425import com .lambda .module .modules .client .ClickGui ;
26+ import com .llamalad7 .mixinextras .injector .wrapoperation .Operation ;
27+ import com .llamalad7 .mixinextras .injector .wrapoperation .WrapOperation ;
28+ import net .minecraft .client .render .Camera ;
2529import net .minecraft .client .render .GameRenderer ;
2630import net .minecraft .client .render .RenderTickCounter ;
31+ import net .minecraft .client .render .WorldRenderer ;
32+ import net .minecraft .client .util .ObjectAllocator ;
33+ import org .joml .Matrix4f ;
2734import org .spongepowered .asm .mixin .Mixin ;
2835import org .spongepowered .asm .mixin .injection .At ;
2936import org .spongepowered .asm .mixin .injection .Inject ;
@@ -37,4 +44,23 @@ private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) {
3744 info .cancel ();
3845 }
3946 }
47+
48+ /**
49+ * Begins our 3d render after the game has rendered the world
50+ * <pre>{@code
51+ * float m = Math.max(h, (float)(Integer)this.client.options.getFov().getValue());
52+ * Matrix4f matrix4f2 = this.getBasicProjectionMatrix(m);
53+ * RenderSystem.setProjectionMatrix(matrix4f, ProjectionType.PERSPECTIVE);
54+ * Quaternionf quaternionf = camera.getRotation().conjugate(new Quaternionf());
55+ * Matrix4f matrix4f3 = (new Matrix4f()).rotation(quaternionf);
56+ * this.client.worldRenderer.setupFrustum(camera.getPos(), matrix4f3, matrix4f2);
57+ * this.client.worldRenderer.render(this.pool, renderTickCounter, bl, camera, this, matrix4f3, matrix4f);
58+ * }</pre>
59+ */
60+ @ WrapOperation (method = "renderWorld" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/render/WorldRenderer;render(Lnet/minecraft/client/util/ObjectAllocator;Lnet/minecraft/client/render/RenderTickCounter;ZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;)V" ))
61+ void onRenderWorld (WorldRenderer instance , ObjectAllocator allocator , RenderTickCounter tickCounter , boolean renderBlockOutline , Camera camera , GameRenderer gameRenderer , Matrix4f positionMatrix , Matrix4f projectionMatrix , Operation <Void > original ) {
62+ original .call (instance , allocator , tickCounter , renderBlockOutline , camera , gameRenderer , positionMatrix , projectionMatrix );
63+
64+ RenderMain .render3D (positionMatrix , projectionMatrix );
65+ }
4066}
0 commit comments