Skip to content

Commit ef09e45

Browse files
committed
Merge remote-tracking branch 'origin/1.21.11' into feature/module/automount
2 parents dcb3d6f + 9bd8bf7 commit ef09e45

File tree

270 files changed

+12797
-7282
lines changed

Some content is hidden

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

270 files changed

+12797
-7282
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ How do I...
8686
<img alt="" src="https://raw.githubusercontent.com/lambda-client/assets/main/footer.png">
8787
</p>
8888

89+
## Developing
90+
91+
### MSA authentication setup
92+
93+
Add `--msa --msa-no-dialog` to your CLI arguments to enable MSA authentication when launching from the IDE.
94+
95+
8996
### Stargazers
9097

9198
[![Stargazers over time](https://starchart.cc/lambda-client/lambda.svg?variant=adaptive)](https://starchart.cc/lambda-client/lambda)

src/main/kotlin/com/lambda/graphics/buffer/vertex/attributes/VertexMode.kt renamed to src/main/java/com/lambda/graphics/outline/IEntityRenderState.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2025 Lambda
2+
* Copyright 2026 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -15,12 +15,13 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
package com.lambda.graphics.buffer.vertex.attributes
18+
package com.lambda.graphics.outline;
1919

20-
import org.lwjgl.opengl.GL11C.GL_LINES
21-
import org.lwjgl.opengl.GL11C.GL_TRIANGLES
20+
/**
21+
* Duck interface for EntityRenderState to store and retrieve entity ID.
22+
*/
23+
public interface IEntityRenderState {
24+
int lambda$getEntityId();
2225

23-
enum class VertexMode(val mode: Int) {
24-
Lines(GL_LINES),
25-
Triangles(GL_TRIANGLES)
26+
void lambda$setEntityId(int id);
2627
}

src/main/java/com/lambda/mixin/MinecraftClientMixin.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void closeImGui(CallbackInfo ci) {
7474

7575
@WrapMethod(method = "render")
7676
void onLoopTick(boolean tick, Operation<Void> original) {
77+
com.lambda.graphics.RenderMain.preRender();
7778
EventFlow.post(TickEvent.Render.Pre.INSTANCE);
7879
original.call(tick);
7980
EventFlow.post(TickEvent.Render.Post.INSTANCE);
@@ -95,7 +96,7 @@ void onNetwork(ClientPlayerInteractionManager instance, Operation<Void> original
9596

9697
@Definition(id = "overlay", field = "Lnet/minecraft/client/MinecraftClient;overlay:Lnet/minecraft/client/gui/screen/Overlay;")
9798
@Expression("this.overlay == null")
98-
@ModifyExpressionValue(method = "tick", at = @At("MIXINEXTRAS:EXPRESSION"))
99+
@ModifyExpressionValue(method = "tick", at = @At(value = "MIXINEXTRAS:EXPRESSION", ordinal = 1))
99100
private boolean modifyCurrentScreenNullCheck(boolean original) {
100101
if (!original || this.currentScreen != null) {
101102
EventFlow.post(TickEvent.Input.Pre.INSTANCE);
@@ -120,11 +121,13 @@ void onSound(SoundManager instance, boolean paused, Operation<Void> original) {
120121

121122
@Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;info(Ljava/lang/String;)V", shift = At.Shift.AFTER, remap = false), method = "stop")
122123
private void onShutdown(CallbackInfo ci) {
124+
com.lambda.graphics.outline.OutlineRenderer.INSTANCE.cleanup();
123125
EventFlow.post(new ClientEvent.Shutdown());
124126
}
125127

126128
/**
127-
* Inject after the thread field is set so that {@link ThreadExecutor#getThread} is available
129+
* Inject after the thread field is set so that {@link ThreadExecutor#getThread}
130+
* is available
128131
*/
129132
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;thread:Ljava/lang/Thread;", shift = At.Shift.AFTER, ordinal = 0, opcode = Opcodes.PUTFIELD), method = "run")
130133
private void onStartup(CallbackInfo ci) {
@@ -175,30 +178,25 @@ boolean redirectMultiActon(boolean original) {
175178
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isRiding()Z"))
176179
void injectFastPlace(CallbackInfo ci) {
177180
if (!Interact.INSTANCE.isEnabled()) return;
178-
179181
itemUseCooldown = Interact.getPlaceDelay();
180182
}
181183

182184
@WrapMethod(method = "doItemUse")
183185
void injectItemUse(Operation<Void> original) {
184-
if (BetterFirework.INSTANCE.isDisabled() || !BetterFirework.onInteract())
185-
original.call();
186+
if (BetterFirework.INSTANCE.isDisabled() || !BetterFirework.onInteract()) original.call();
186187
}
187188

188189
@WrapMethod(method = "doItemPick")
189190
void injectItemPick(Operation<Void> original) {
190-
if (BetterFirework.INSTANCE.isDisabled() || !BetterFirework.onPick())
191-
original.call();
191+
if (BetterFirework.INSTANCE.isDisabled() || !BetterFirework.onPick()) original.call();
192192
}
193193

194194
@WrapMethod(method = "getTargetMillisPerTick")
195195
float getTargetMillisPerTick(float millis, Operation<Float> original) {
196196
var length = TimerManager.INSTANCE.getLength();
197197

198-
if (length == TimerManager.DEFAULT_LENGTH)
199-
return original.call(millis);
200-
else
201-
return (float) TimerManager.INSTANCE.getLength();
198+
if (length == TimerManager.DEFAULT_LENGTH) return original.call(millis);
199+
else return (float) TimerManager.INSTANCE.getLength();
202200
}
203201

204202
@Inject(method = "updateWindowTitle", at = @At("HEAD"), cancellable = true)

src/main/java/com/lambda/mixin/baritone/BaritonePlayerContextMixin.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ Rotation syncRotationWithBaritone(Rotation original) {
4040
if (baritone != BaritoneManager.getPrimary())
4141
return original;
4242

43-
return new Rotation((float) RotationManager.getActiveRotation().getYaw(), (float) RotationManager.getActiveRotation().getPitch());
43+
float yaw = (float) RotationManager.getActiveRotation().getYaw();
44+
float pitch = (float) RotationManager.getActiveRotation().getPitch();
45+
46+
if (Float.isNaN(yaw) || Float.isNaN(pitch)) {
47+
return original;
48+
}
49+
50+
return new Rotation(net.minecraft.util.math.MathHelper.wrapDegrees(yaw), pitch);
4451
}
4552
}

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

Lines changed: 36 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -17,60 +17,67 @@
1717

1818
package com.lambda.mixin.entity;
1919

20-
import com.lambda.Lambda;
2120
import com.lambda.event.EventFlow;
2221
import com.lambda.event.events.MovementEvent;
2322
import com.lambda.event.events.PlayerEvent;
2423
import com.lambda.event.events.PlayerPacketEvent;
2524
import com.lambda.event.events.TickEvent;
26-
import com.lambda.interaction.managers.rotating.Rotation;
2725
import com.lambda.interaction.managers.rotating.RotationManager;
2826
import com.lambda.module.modules.movement.ElytraFly;
2927
import com.lambda.module.modules.movement.NoJumpCooldown;
3028
import com.lambda.module.modules.player.PortalGui;
3129
import com.lambda.module.modules.render.ViewModel;
32-
import com.llamalad7.mixinextras.expression.Definition;
33-
import com.llamalad7.mixinextras.expression.Expression;
3430
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
3531
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
3632
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
3733
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
3834
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
39-
import com.llamalad7.mixinextras.sugar.Local;
35+
import com.llamalad7.mixinextras.sugar.Share;
36+
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
4037
import com.mojang.authlib.GameProfile;
4138
import net.minecraft.client.gui.screen.Screen;
4239
import net.minecraft.client.input.Input;
4340
import net.minecraft.client.network.AbstractClientPlayerEntity;
41+
import net.minecraft.client.network.ClientPlayNetworkHandler;
4442
import net.minecraft.client.network.ClientPlayerEntity;
4543
import net.minecraft.client.world.ClientWorld;
4644
import net.minecraft.entity.MovementType;
45+
import net.minecraft.network.packet.Packet;
4746
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
4847
import net.minecraft.util.Hand;
48+
import net.minecraft.util.math.Vec2f;
4949
import net.minecraft.util.math.Vec3d;
5050
import org.objectweb.asm.Opcodes;
5151
import org.spongepowered.asm.mixin.Mixin;
52-
import org.spongepowered.asm.mixin.Shadow;
53-
import org.spongepowered.asm.mixin.Unique;
5452
import org.spongepowered.asm.mixin.injection.At;
5553
import org.spongepowered.asm.mixin.injection.Inject;
5654
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
57-
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
5855

5956
import java.util.Objects;
6057

58+
import static com.lambda.Lambda.getMc;
59+
6160
@Mixin(value = ClientPlayerEntity.class, priority = Integer.MAX_VALUE)
6261
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {
63-
@Shadow
64-
private float lastYawClient;
65-
@Shadow
66-
private float lastPitchClient;
67-
@Unique
68-
private PlayerPacketEvent.Pre moveEvent;
69-
7062
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
7163
super(world, profile);
7264
}
7365

66+
@WrapMethod(method = "tick")
67+
void onTick(Operation<Void> original) {
68+
EventFlow.post(TickEvent.Player.Pre.INSTANCE);
69+
original.call();
70+
EventFlow.post(TickEvent.Player.Post.INSTANCE);
71+
}
72+
73+
@Inject(method = "tick", at = @At("HEAD"))
74+
private void injectTick(CallbackInfo ci, @Share(namespace = "shared_rotations", value = "target_rotation") final LocalRef<Vec2f> targetRotation) {
75+
if (RotationManager.getRequests().stream().anyMatch(Objects::nonNull)) {
76+
final var activeRotation = RotationManager.getActiveRotation();
77+
targetRotation.set(new Vec2f(activeRotation.getYawF(), activeRotation.getPitchF()));
78+
}
79+
}
80+
7481
@WrapOperation(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"))
7582
private void wrapMove(ClientPlayerEntity instance, MovementType movementType, Vec3d vec3d, Operation<Void> original) {
7683
EventFlow.post(new MovementEvent.Player.Pre(movementType, vec3d));
@@ -91,43 +98,23 @@ private void injectTickMovement(CallbackInfo ci) {
9198
if (NoJumpCooldown.INSTANCE.isEnabled() || (ElytraFly.INSTANCE.isEnabled() && ElytraFly.getMode() == ElytraFly.FlyMode.Bounce)) jumpingCooldown = 0;
9299
}
93100

94-
@Inject(method = "sendMovementPackets", at = @At("HEAD"))
95-
private void injectSendMovementPacketsHead(CallbackInfo ci) {
96-
moveEvent = EventFlow.post(new PlayerPacketEvent.Pre(pos, RotationManager.getActiveRotation(), isOnGround(), isSprinting(), horizontalCollision));
97-
}
98-
99-
@Definition(id = "g", local = @Local(type = double.class, ordinal = 3))
100-
@Expression("g != 0.0")
101-
@ModifyExpressionValue(method = "sendMovementPackets", at = @At("MIXINEXTRAS:EXPRESSION"))
102-
private boolean modifyHasRotated(boolean original) {
103-
return !RotationManager.getActiveRotation().equalFloat(RotationManager.getServerRotation()) || original;
101+
@ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getYaw()F"))
102+
private float modifyGetYaw(float original) {
103+
final var yaw = RotationManager.getHeadYaw();
104+
return yaw != null ? yaw : original;
104105
}
105106

106-
@Inject(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
107-
private void injectSendPacket(CallbackInfo ci, double d, double e, double f, double g, double h, boolean bl, boolean bl2) {
108-
if (RotationManager.getRequests().stream().allMatch(Objects::isNull)) {
109-
moveEvent.setRotation(new Rotation(g + lastYawClient, h + lastPitchClient));
110-
}
111-
}
112-
113-
@WrapOperation(method = "sendMovementPackets", at = @At(value = "NEW", target = "net/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket$Full"))
114-
private PlayerMoveC2SPacket.Full wrapFullPacket(Vec3d pos, float yaw, float pitch, boolean onGround, boolean horizontalCollision, Operation<PlayerMoveC2SPacket.Full> original) {
115-
return original.call(moveEvent.getPosition(), moveEvent.getRotation().getYawF(), moveEvent.getRotation().getPitchF(), moveEvent.getOnGround(), moveEvent.isCollidingHorizontally());
116-
}
117-
118-
@WrapOperation(method = "sendMovementPackets", at = @At(value = "NEW", target = "net/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket$PositionAndOnGround"))
119-
private PlayerMoveC2SPacket.PositionAndOnGround wrapPositionAndOnGround(Vec3d pos, boolean onGround, boolean horizontalCollision, Operation<PlayerMoveC2SPacket.PositionAndOnGround> original) {
120-
return original.call(moveEvent.getPosition(), moveEvent.getOnGround(), moveEvent.isCollidingHorizontally());
121-
}
122-
123-
@WrapOperation(method = "sendMovementPackets", at = @At(value = "NEW", target = "net/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket$LookAndOnGround"))
124-
private PlayerMoveC2SPacket.LookAndOnGround wrapLookAndOnGround(float yaw, float pitch, boolean onGround, boolean horizontalCollision, Operation<PlayerMoveC2SPacket.LookAndOnGround> original) {
125-
return original.call(moveEvent.getRotation().getYawF(), moveEvent.getRotation().getPitchF(), moveEvent.getOnGround(), moveEvent.isCollidingHorizontally());
107+
@ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getPitch()F"))
108+
private float modifyGetPitch(float original) {
109+
final var pitch = RotationManager.getHeadPitch();
110+
return pitch != null ? pitch : original;
126111
}
127112

128-
@WrapOperation(method = "sendMovementPackets", at = @At(value = "NEW", target = "net/minecraft/network/packet/c2s/play/PlayerMoveC2SPacket$OnGroundOnly"))
129-
private PlayerMoveC2SPacket.OnGroundOnly wrapOnGroundOnly(boolean onGround, boolean horizontalCollision, Operation<PlayerMoveC2SPacket.OnGroundOnly> original) {
130-
return original.call(moveEvent.getOnGround(), moveEvent.isCollidingHorizontally());
113+
@WrapOperation(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V"))
114+
private void wrapSendPacket(ClientPlayNetworkHandler instance, Packet packet, Operation<Void> original) {
115+
var event = EventFlow.post(new PlayerPacketEvent.Send((PlayerMoveC2SPacket) packet));
116+
if (event.isCanceled()) return;
117+
original.call(instance, event.getPacket());
131118
}
132119

133120
@Inject(method = "sendMovementPackets", at = @At("TAIL"))
@@ -144,19 +131,11 @@ boolean modifyIsSprinting(boolean original) {
144131
@ModifyReturnValue(method = "isSneaking", at = @At("RETURN"))
145132
boolean injectSneakingInput(boolean original) {
146133
ClientPlayerEntity self = (ClientPlayerEntity) (Object) this;
147-
if (self != Lambda.getMc().player ||
148-
self.input == null) return original;
134+
if (self != getMc().player || self.input == null) return original;
149135

150136
return EventFlow.post(new MovementEvent.Sneak(self.input.playerInput.sneak())).getSneak();
151137
}
152138

153-
@WrapMethod(method = "tick")
154-
void onTick(Operation<Void> original) {
155-
EventFlow.post(TickEvent.Player.Pre.INSTANCE);
156-
original.call();
157-
EventFlow.post(TickEvent.Player.Post.INSTANCE);
158-
}
159-
160139
@WrapOperation(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getYaw()F"))
161140
float wrapGetYaw(ClientPlayerEntity instance, Operation<Float> original) {
162141
return Objects.requireNonNullElse(RotationManager.getHandYaw(), original.call(instance));

src/main/java/com/lambda/mixin/entity/EntityMixin.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.lambda.mixin.entity;
1919

20+
import com.lambda.Lambda;
2021
import com.lambda.event.EventFlow;
2122
import com.lambda.event.events.EntityEvent;
2223
import com.lambda.event.events.PlayerEvent;
@@ -45,8 +46,7 @@
4546
@Mixin(Entity.class)
4647
public abstract class EntityMixin {
4748
@Shadow
48-
public void move(MovementType movementType, Vec3d movement) {
49-
}
49+
public void move(MovementType movementType, Vec3d movement) {}
5050

5151
@Shadow
5252
public abstract float getYaw();
@@ -151,11 +151,13 @@ private boolean modifyGetFlagGlowing(boolean original) {
151151

152152
@WrapWithCondition(method = "changeLookDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setYaw(F)V"))
153153
private boolean wrapSetYaw(Entity instance, float yaw) {
154+
if ((Object) this != getMc().player) return true;
154155
return RotationManager.getLockYaw() == null;
155156
}
156157

157158
@WrapWithCondition(method = "changeLookDirection", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setPitch(F)V"))
158159
private boolean wrapSetPitch(Entity instance, float yaw) {
160+
if ((Object) this != getMc().player) return true;
159161
return RotationManager.getLockPitch() == null;
160162
}
161163

@@ -175,8 +177,7 @@ private EntityPose injectGetPose(EntityPose original) {
175177
var player = getMc().player;
176178
if ((Object) this != getMc().player) return original;
177179

178-
if (ElytraFly.INSTANCE.isDisabled() ||
179-
ElytraFly.getMode() != ElytraFly.FlyMode.Bounce || !player.isGliding()) return original;
180+
if (ElytraFly.INSTANCE.isDisabled() || ElytraFly.getMode() != ElytraFly.FlyMode.Bounce || !player.isGliding()) return original;
180181

181182
return EntityPose.GLIDING;
182183
}

src/main/java/com/lambda/mixin/items/BarrierBlockMixin.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)