Skip to content

Commit 31f4677

Browse files
committed
Merge branch 'master' into feature/combat
2 parents 5a18dd0 + dc57931 commit 31f4677

File tree

107 files changed

+3108
-537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3108
-537
lines changed

common/src/main/java/com/lambda/mixin/entity/ClientPlayerEntityMixin.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ boolean onSlowDown(ClientPlayerEntity entity) {
5757

5858
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(ZF)V"))
5959
void processMovement(Input input, boolean slowDown, float slowDownFactor) {
60-
if (EventFlow.post(new MovementEvent.InputUpdate(input, slowDown, slowDownFactor)).isCanceled()) return;
61-
6260
input.tick(slowDown, slowDownFactor);
61+
EventFlow.post(new MovementEvent.InputUpdate(input, slowDown, slowDownFactor));
6362
}
6463

6564
@Inject(method = "sendMovementPackets", at = @At(value = "HEAD"), cancellable = true)

common/src/main/java/com/lambda/mixin/entity/PlayerEntityMixin.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
import com.lambda.event.EventFlow;
44
import com.lambda.event.events.MovementEvent;
5+
import com.lambda.interaction.RotationManager;
6+
import net.minecraft.client.MinecraftClient;
57
import net.minecraft.entity.player.PlayerEntity;
68
import org.spongepowered.asm.mixin.Mixin;
79
import org.spongepowered.asm.mixin.injection.At;
810
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.Redirect;
912
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1013

1114
@Mixin(PlayerEntity.class)
@@ -15,4 +18,14 @@ private void injectSafeWalk(CallbackInfoReturnable<Boolean> cir) {
1518
MovementEvent.ClipAtLedge event = new MovementEvent.ClipAtLedge(((PlayerEntity) (Object) this).isSneaking());
1619
cir.setReturnValue(EventFlow.post(event).getClip());
1720
}
21+
22+
@Redirect(method = "tickNewAi", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getYaw()F"))
23+
private float injectHeadYaw(PlayerEntity instance) {
24+
if ((Object) this != MinecraftClient.getInstance().player) {
25+
return instance.getYaw();
26+
}
27+
28+
Float yaw = RotationManager.getRenderYaw();
29+
return (yaw != null) ? yaw : instance.getYaw();
30+
}
1831
}

common/src/main/java/com/lambda/mixin/render/CameraMixin.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
package com.lambda.mixin.render;
22

3+
import com.lambda.interaction.RotationManager;
34
import com.lambda.module.modules.player.Freecam;
45
import net.minecraft.client.render.Camera;
56
import net.minecraft.entity.Entity;
67
import net.minecraft.world.BlockView;
78
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.Shadow;
810
import org.spongepowered.asm.mixin.injection.At;
911
import org.spongepowered.asm.mixin.injection.Inject;
1012
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1113

1214
@Mixin(Camera.class)
13-
public class CameraMixin {
15+
public abstract class CameraMixin {
16+
@Shadow
17+
public abstract void setRotation(float yaw, float pitch);
18+
1419
@Inject(method = "update", at = @At("TAIL"))
1520
private void onUpdate(
1621
BlockView area,
@@ -24,4 +29,11 @@ private void onUpdate(
2429

2530
Freecam.updateCam();
2631
}
32+
33+
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setPos(DDD)V", shift = At.Shift.AFTER))
34+
private void injectQuickPerspectiveSwap(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
35+
var rot = RotationManager.getLockRotation();
36+
if (rot == null) return;
37+
setRotation(rot.getYawF(), rot.getPitchF());
38+
}
2739
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.graphics.gl.GlStateUtils;
4+
import com.mojang.blaze3d.platform.GlStateManager;
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.injection.At;
7+
import org.spongepowered.asm.mixin.injection.Inject;
8+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
9+
10+
import static org.lwjgl.opengl.GL11.*;
11+
import static org.lwjgl.opengl.GL11.GL_CULL_FACE;
12+
13+
@Mixin(GlStateManager.class)
14+
public class GlStateManagerMixin {
15+
@Inject(method = "_enableDepthTest", at = @At("TAIL"), remap = false)
16+
private static void depthTestEnable(CallbackInfo ci) {
17+
GlStateUtils.capSet(GL_DEPTH_TEST, true);
18+
}
19+
20+
@Inject(method = "_disableDepthTest", at = @At("TAIL"), remap = false)
21+
private static void depthTestDisable(CallbackInfo ci) {
22+
GlStateUtils.capSet(GL_DEPTH_TEST, false);
23+
}
24+
25+
@Inject(method = "_depthMask", at = @At("TAIL"), remap = false)
26+
private static void depthMask(boolean mask, CallbackInfo ci) {
27+
GlStateUtils.capSet(GL_DEPTH, mask);
28+
}
29+
30+
@Inject(method = "_enableBlend", at = @At("TAIL"), remap = false)
31+
private static void blendEnable(CallbackInfo ci) {
32+
GlStateUtils.capSet(GL_BLEND, true);
33+
}
34+
35+
@Inject(method = "_disableBlend", at = @At("TAIL"), remap = false)
36+
private static void blendDisable(CallbackInfo ci) {
37+
GlStateUtils.capSet(GL_BLEND, false);
38+
}
39+
40+
@Inject(method = "_enableCull", at = @At("TAIL"), remap = false)
41+
private static void cullEnable(CallbackInfo ci) {
42+
GlStateUtils.capSet(GL_CULL_FACE, true);
43+
}
44+
45+
@Inject(method = "_disableCull", at = @At("TAIL"), remap = false)
46+
private static void cullDisable(CallbackInfo ci) {
47+
GlStateUtils.capSet(GL_CULL_FACE, false);
48+
}
49+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.graphics.RenderMain;
4+
import net.minecraft.client.gui.DrawContext;
5+
import net.minecraft.client.gui.hud.InGameHud;
6+
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.injection.At;
8+
import org.spongepowered.asm.mixin.injection.Inject;
9+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
10+
11+
@Mixin(InGameHud.class)
12+
public class InGameHudMixin {
13+
@Inject(method = "render", at = @At("TAIL"))
14+
private void onRender(DrawContext context, float tickDelta, CallbackInfo ci) {
15+
RenderMain.render2D();
16+
}
17+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.module.modules.render.Fullbright;
4+
import com.lambda.module.modules.render.NoRender;
5+
import com.lambda.module.modules.render.XRay;
6+
import net.minecraft.client.render.LightmapTextureManager;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
import org.spongepowered.asm.mixin.injection.Inject;
10+
import org.spongepowered.asm.mixin.injection.ModifyArgs;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
12+
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
13+
14+
@Mixin(LightmapTextureManager.class)
15+
public class LightmapTextureManagerMixin {
16+
@ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V"))
17+
private void updateModify(Args args) {
18+
if (Fullbright.INSTANCE.isEnabled() || XRay.INSTANCE.isEnabled()) {
19+
args.set(2, 0xFFFFFFFF);
20+
}
21+
}
22+
23+
@Inject(method = "getDarknessFactor(F)F", at = @At("HEAD"), cancellable = true)
24+
private void getDarknessFactor(float tickDelta, CallbackInfoReturnable<Float> info) {
25+
if (NoRender.getNoDarkness()) info.setReturnValue(0.0f);
26+
}
27+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.Lambda;
4+
import com.lambda.interaction.RotationManager;
5+
import net.minecraft.client.render.VertexConsumerProvider;
6+
import net.minecraft.client.render.entity.LivingEntityRenderer;
7+
import net.minecraft.client.util.math.MatrixStack;
8+
import net.minecraft.entity.LivingEntity;
9+
import net.minecraft.util.math.MathHelper;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.Unique;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
import org.spongepowered.asm.mixin.injection.Inject;
14+
import org.spongepowered.asm.mixin.injection.Redirect;
15+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
16+
17+
import java.util.Objects;
18+
19+
@Mixin(LivingEntityRenderer.class)
20+
public class LivingEntityRendererMixin<T extends LivingEntity> {
21+
@Unique
22+
private Float lambda$pitch = null;
23+
24+
@Inject(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"))
25+
private void injectRender(T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) {
26+
Float rotationPitch = RotationManager.getRenderPitch();
27+
28+
this.lambda$pitch = null;
29+
30+
if (livingEntity != Lambda.getMc().player || rotationPitch == null) {
31+
return;
32+
}
33+
34+
this.lambda$pitch = rotationPitch;
35+
}
36+
37+
@Redirect(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F", ordinal = 0))
38+
private float injectRotationPitch(float g, float f, float s) {
39+
return Objects.requireNonNullElseGet(lambda$pitch, () -> MathHelper.lerp(g, f, s));
40+
}
41+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.lambda.mixin.render;
2+
3+
import com.lambda.graphics.gl.VaoUtils;
4+
import com.mojang.blaze3d.systems.RenderSystem;
5+
import net.minecraft.client.gl.VertexBuffer;
6+
import net.minecraft.client.render.BufferBuilder;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.Shadow;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
12+
13+
import java.nio.ByteBuffer;
14+
15+
@Mixin(VertexBuffer.class)
16+
public class VertexBufferMixin {
17+
@Shadow
18+
private int indexBufferId;
19+
20+
@Inject(method = "uploadIndexBuffer", at = @At("RETURN"))
21+
private void onConfigureIndexBuffer(BufferBuilder.DrawParameters parameters, ByteBuffer vertexBuffer, CallbackInfoReturnable<RenderSystem.ShapeIndexBuffer> cir) {
22+
RenderSystem.ShapeIndexBuffer value = cir.getReturnValue();
23+
VaoUtils.lastIbo = value == null ? this.indexBufferId : value.id;
24+
}
25+
}

common/src/main/kotlin/com/lambda/Lambda.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ package com.lambda
33
import com.google.gson.Gson
44
import com.google.gson.GsonBuilder
55
import com.lambda.config.serializer.*
6+
import com.lambda.config.serializer.gui.ModuleTagSerializer
7+
import com.lambda.config.serializer.gui.TagWindowSerializer
68
import com.lambda.core.Loader
9+
import com.lambda.gui.impl.clickgui.windows.TagWindow
710
import com.lambda.module.tag.ModuleTag
811
import com.lambda.util.KeyCode
912
import net.minecraft.block.Block
@@ -24,6 +27,7 @@ object Lambda {
2427
val gson: Gson = GsonBuilder()
2528
.setPrettyPrinting()
2629
.registerTypeAdapter(ModuleTag::class.java, ModuleTagSerializer)
30+
.registerTypeAdapter(TagWindow::class.java, TagWindowSerializer)
2731
.registerTypeAdapter(KeyCode::class.java, KeyCodeSerializer)
2832
.registerTypeAdapter(Color::class.java, ColorSerializer)
2933
.registerTypeAdapter(BlockPos::class.java, BlockPosSerializer)

common/src/main/kotlin/com/lambda/command/CommandManager.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import org.reflections.Reflections
2020
import org.reflections.scanners.Scanners
2121
import org.reflections.util.ClasspathHelper
2222
import org.reflections.util.ConfigurationBuilder
23+
import java.awt.Color
2324
import kotlin.math.max
2425
import kotlin.math.min
2526

@@ -95,7 +96,7 @@ object CommandManager : Configurable(LambdaConfig), Loadable {
9596
val position = min(syntax.input.length, syntax.cursor)
9697
player.sendMessage(buildText {
9798
clickEvent(suggestCommand("$prefix${reader.string}")) {
98-
color(Color.GREY) {
99+
color(Color.GRAY) {
99100
if (position > ERROR_PADDING) {
100101
literal("...")
101102
}

0 commit comments

Comments
 (0)