Skip to content

Commit ec08702

Browse files
committed
Merge branch '1.21.5' into refactor/3d
2 parents 5c60e43 + e209394 commit ec08702

File tree

112 files changed

+2375
-1575
lines changed

Some content is hidden

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

112 files changed

+2375
-1575
lines changed

README.md

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,66 @@
1-
# Lambda
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/lambda-client/assets/main/lambda%20logo%20text.svg" style="width: 69%" alt="logo">
3+
</p>
24

3-
[![Minecraft](https://img.shields.io/badge/Minecraft-1.21.5-lime?style=for-the-badge&link=https://www.minecraft.net/)](https://www.minecraft.net/)
4-
[![License](https://img.shields.io/badge/License-GPL%20v3-blue?style=for-the-badge&link=https://www.gnu.org/licenses/gpl-3.0.en.html)](https://www.gnu.org/licenses/gpl-3.0.en.html)
5+
![Minecraft](https://img.shields.io/badge/minecraft-1.21.5-green?link=https%3A%2F%2Fwww.minecraft.net%2F)
6+
![GitHub Downloads](https://img.shields.io/github/downloads/lambda-client/lambda/total)
7+
![Discord](https://img.shields.io/discord/834570721070022687?logo=Discord&logoColor=white&link=https%3A%2F%2Fdiscord.gg%2FMBAEzyFn)
8+
![CodeFactor grade](https://img.shields.io/codefactor/grade/github/lambda-client/lambda?color=royalblue)
9+
![GitHub workflow status](https://img.shields.io/github/actions/workflow/status/lambda-client/lambda/build.yml?branch=1.21.5&logo=gradle)
10+
![GitHub contributors](https://img.shields.io/github/contributors/lambda-client/lambda)
11+
![GitHub Repo stars](https://img.shields.io/github/stars/lambda-client/lambda)
12+
![GitHub License](https://img.shields.io/github/license/lambda-client/lambda?logo=gplv3&link=https%3A%2F%2Fwww.gnu.org%2Flicenses%2Fgpl-3.0.en.html)
513

6-
<div align="center">
7-
<a href="https://discord.gg/3y3ah5BtjB"><img src="https://invidget.switchblade.xyz/3y3ah5BtjB" alt="Link to the lambda discord server https://discord.gg/3y3ah5BtjB"></a>
8-
</div>
14+
Lambda is a free, open-source Minecraft Fabric utility mod focused on advanced automation to execute complex, repeatable tasks with minimal micromanagement.
915

10-
## License
16+
<p align="center">
17+
<a href="https://github.com/lambda-client/lambda/releases/download/1.0.0/lambda-1.0.0.jar"><img alt="lambda-1.0.0.jar" src="https://raw.githubusercontent.com/lambda-client/assets/main/download_button_1.0.0.png" width="70%" height="70%"></a>
18+
</p>
1119

12-
Lambda is distributed under
13-
the [GNU General Public License v3.0](https://github.com/Avanatiker/NeoLambda/blob/master/LICENSE.md).
20+
<p align="center">
21+
<a href="https://discord.gg/MBAEzyFn"><img src="https://invidget.switchblade.xyz/MBAEzyFn" alt="Link to the lambda discord server https://discord.gg/MBAEzyFn"></a>
22+
</p>
23+
24+
Find our matrix space at [#lambda-client:matrix.org](https://app.element.io/#/room/#lambda-client:matrix.org).
25+
26+
## Installation
27+
<a href="https://fabricmc.net/wiki/install"><img src="https://cdn.jonasjones.dev/mod-badges/support-fabric.png" width="150px" alt="Fabric Supported"></a>
28+
1. Install Minecraft 1.21.5 [(download)](https://www.minecraft.net/)
29+
2. Install Fabric [(download)](https://fabricmc.net/use/installer/)
30+
3. Get the latest Lambda version here [(download)](https://github.com/lambda-client/lambda/releases/download/1.0.0/lambda-1.0.0.jar)
31+
4. Put the file in your `.minecraft/mods` folder
32+
33+
## FAQ
34+
35+
How do I...
36+
37+
<details>
38+
<summary>... open the ClickGUI?</summary>
39+
40+
> Press `Y`.
41+
42+
</details>
43+
44+
<details>
45+
<summary>... execute a command?</summary>
46+
47+
> Use the ingame chat with the prefix `;`.
48+
49+
</details>
50+
51+
<p align="center">
52+
<img alt="" src="https://raw.githubusercontent.com/lambda-client/assets/main/footer.png">
53+
</p>
54+
55+
## Thanks to...
56+
57+
[![GitHub contributors](https://contrib.rocks/image?repo=lambda-client/lambda)](https://github.com/lambda-client/lambda/graphs/contributors)
1458

1559
---
1660

1761
If you have any questions, concerns, or suggestions,
18-
you can visit our [official Discord server](https://discord.gg/3y3ah5BtjB).
62+
you can visit our [official Discord server](https://discord.gg/MBAEzyFn).
1963

20-
**Disclaimer:** Lambda is not affiliated with Mojang Studios. Minecraft is a registered trademark of Mojang Studios.
21-
Use of the Lambda software is subject to the terms outlined in the license agreement.
64+
> ### Disclaimer
65+
> Lambda is not affiliated with Mojang Studios. Minecraft is a registered trademark of Mojang Studios.
66+
Use of the Lambda software is subject to the terms outlined in the license agreement [GNU General Public License v3.0](https://github.com/lambda-client/lambda/blob/master/LICENSE.md).

build.gradle.kts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ repositories {
7171
mavenLocal() // Allow the use of local repositories
7272
maven("https://maven.2b2t.vc/releases") // Baritone
7373
maven("https://jitpack.io") // KDiscordIPC
74-
maven("https://raw.githubusercontent.com/kotlin-graphics/mary/master")
7574
mavenCentral()
7675

7776
// Allow the use of local libraries
@@ -111,7 +110,7 @@ loom {
111110
property("mixin.debug.export", "true")
112111

113112
vmArgs("-XX:+HeapDumpOnOutOfMemoryError", "-XX:+CreateCoredumpOnCrash", "-XX:+UseOSErrorReporting")
114-
programArgs("--username", "Steve", "--uuid", "8667ba71b85a4004af54457a9734eed7", "--accessToken", "<TOKEN>")
113+
programArgs("--username", "Steve", "--uuid", "8667ba71b85a4004af54457a9734eed7", "--accessToken", "****")
115114
}
116115
}
117116
}
@@ -160,9 +159,9 @@ dependencies {
160159

161160
includeLib("io.github.spair:imgui-java-binding:$spairVersion")
162161
includeLib("io.github.spair:imgui-java-lwjgl3:$spairVersion")
163-
runtimeOnly("io.github.spair:imgui-java-natives-windows:$spairVersion")
164-
runtimeOnly("io.github.spair:imgui-java-natives-linux:$spairVersion")
165-
runtimeOnly("io.github.spair:imgui-java-natives-macos:$spairVersion")
162+
includeLib("io.github.spair:imgui-java-natives-windows:$spairVersion")
163+
includeLib("io.github.spair:imgui-java-natives-linux:$spairVersion")
164+
includeLib("io.github.spair:imgui-java-natives-macos:$spairVersion")
166165

167166
// Ktor
168167
includeLib("io.ktor:ktor-client-core:$ktorVersion")
@@ -255,3 +254,15 @@ java {
255254
sourceCompatibility = JavaVersion.VERSION_21
256255
targetCompatibility = JavaVersion.VERSION_21
257256
}
257+
258+
publishing {
259+
publications {
260+
create<MavenPublication>("maven") {
261+
groupId = mavenGroup
262+
artifactId = modId
263+
version = "$modVersion+$minecraftVersion"
264+
265+
from(components["java"])
266+
}
267+
}
268+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ktorVersion=3.1.2
4040
mockitoKotlin=5.4.0
4141
mockitoInline=5.2.0
4242
mockkVersion=1.13.17
43-
spairVersion=1.89.0
43+
spairVersion=1.90.0
4444

4545
# Fabric https://fabricmc.net/develop/
4646
fabricLoaderVersion=0.16.13

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ void injectConstructor(String message, Throwable cause, CallbackInfo ci) {
5454
@WrapMethod(method = "asString(Lnet/minecraft/util/crash/ReportType;Ljava/util/List;)Ljava/lang/String;")
5555
String injectString(ReportType type, List<String> extraInfo, Operation<String> original) {
5656
var list = new ArrayList<>(extraInfo);
57-
58-
list.add("If this issue is related to Lambda, check if other users have experienced this too, or create a new issue at https://github.com/lambda-client/lambda/issues.\n\n");
57+
list.add("If this issue is related to Lambda, check if other users have experienced this too, or create a new issue at " + Lambda.REPO_URL + "/issues.\n\n");
5958

6059
if (MinecraftClient.getInstance() != null) {
6160
list.add("Enabled modules:");

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
package com.lambda.mixin;
1919

20-
import com.lambda.Lambda;
2120
import com.lambda.event.EventFlow;
2221
import com.lambda.event.events.ClientEvent;
2322
import com.lambda.event.events.InventoryEvent;
2423
import com.lambda.event.events.TickEvent;
2524
import com.lambda.gui.DearImGui;
2625
import com.lambda.module.modules.player.Interact;
26+
import com.lambda.module.modules.player.InventoryMove;
2727
import com.lambda.module.modules.player.PacketMine;
2828
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
2929
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
@@ -33,6 +33,7 @@
3333
import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider;
3434
import net.minecraft.client.network.ClientPlayerEntity;
3535
import net.minecraft.client.network.ClientPlayerInteractionManager;
36+
import net.minecraft.client.option.KeyBinding;
3637
import net.minecraft.client.render.WorldRenderer;
3738
import net.minecraft.client.sound.SoundManager;
3839
import net.minecraft.util.Hand;
@@ -51,10 +52,14 @@ public class MinecraftClientMixin {
5152
@Shadow
5253
@Nullable
5354
public Screen currentScreen;
55+
5456
@Shadow
5557
@Nullable
5658
public HitResult crosshairTarget;
5759

60+
@Shadow
61+
public int itemUseCooldown;
62+
5863
@Inject(method = "close", at = @At("HEAD"))
5964
void closeImGui(CallbackInfo ci) {
6065
DearImGui.INSTANCE.destroy();
@@ -131,6 +136,19 @@ private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) {
131136
}
132137
}
133138

139+
@Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V"))
140+
private void redirectUnPressAll() {
141+
if (!InventoryMove.getShouldMove()) {
142+
KeyBinding.unpressAll();
143+
return;
144+
}
145+
KeyBinding.KEYS_BY_ID.values().forEach(bind -> {
146+
if (!InventoryMove.isKeyMovementRelated(bind.boundKey.getCode())) {
147+
bind.reset();
148+
}
149+
});
150+
}
151+
134152
@Redirect(method = "doAttack()Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
135153
private void redirectHandSwing(ClientPlayerEntity instance, Hand hand) {
136154
if (this.crosshairTarget == null) return;
@@ -151,6 +169,6 @@ boolean redirectMultiActon(ClientPlayerInteractionManager instance) {
151169
void injectFastPlace(CallbackInfo ci) {
152170
if (!Interact.INSTANCE.isEnabled()) return;
153171

154-
Lambda.getMc().itemUseCooldown = Interact.getPlaceDelay();
172+
itemUseCooldown = Interact.getPlaceDelay();
155173
}
156174
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void onTargetUpdate(Rotation rotation, boolean blockInteract, CallbackInfo ci) {
3636
LookBehavior instance = ((LookBehavior) (Object) this);
3737
if (instance.baritone != BaritoneUtils.getPrimary()) return;
3838

39-
RotationManager.BaritoneProcessor.handleBaritoneRotation(rotation.getYaw(), rotation.getPitch());
39+
RotationManager.handleBaritoneRotation(rotation.getYaw(), rotation.getPitch());
4040
ci.cancel();
4141
}
4242

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

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import net.minecraft.client.world.ClientWorld;
3838
import net.minecraft.entity.MovementType;
3939
import net.minecraft.util.Hand;
40-
import net.minecraft.util.math.MathHelper;
4140
import net.minecraft.util.math.Vec3d;
4241
import org.spongepowered.asm.mixin.Final;
4342
import org.spongepowered.asm.mixin.Mixin;
@@ -60,80 +59,50 @@ public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
6059
super(world, profile);
6160
}
6261

63-
@Shadow protected abstract void autoJump(float dx, float dz);
64-
65-
/**
66-
* Post movement events and applies the modified player velocity
67-
*/
68-
@Inject(method = "move", at = @At("HEAD"), cancellable = true)
69-
void onMove(MovementType movementType, Vec3d movement, CallbackInfo ci) {
70-
ClientPlayerEntity self = (ClientPlayerEntity) (Object) this;
71-
if (self != Lambda.getMc().player) return;
72-
73-
ci.cancel();
74-
75-
float prevX = (float) self.getX();
76-
float prevZ = (float) self.getZ();
77-
62+
@Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"))
63+
private void emitMovementEvents(AbstractClientPlayerEntity instance, MovementType movementType, Vec3d movement) {
7864
EventFlow.post(new MovementEvent.Player.Pre(movementType, movement));
7965
super.move(movementType, movement);
8066
EventFlow.post(new MovementEvent.Player.Post(movementType, movement));
81-
82-
float deltaX = (float) self.getX() - prevX;
83-
float deltaZ = (float) self.getZ() - prevZ;
84-
85-
this.autoJump(deltaX, deltaZ);
86-
this.distanceMoved = this.distanceMoved + MathHelper.hypot(deltaX, deltaZ) * 0.6F;
8767
}
8868

8969
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick()V"))
9070
void processMovement(Input input) {
9171
input.tick();
9272
RotationManager.processRotations();
93-
RotationManager.BaritoneProcessor.processPlayerMovement(input);
73+
RotationManager.redirectStrafeInputs(input);
9474
EventFlow.post(new MovementEvent.InputUpdate(input));
9575
}
9676

9777
/**
98-
* Posts the {@link MovementEvent.Sprint} event
99-
* <pre>{@code
100-
* if (this.isSprinting()) {
101-
* boolean bl8 = !this.input.hasForwardMovement() || !this.canSprint();
102-
* boolean bl9 = bl8 || this.horizontalCollision && !this.collidedSoftly || this.isTouchingWater() && !this.isSubmergedInWater();
103-
* if (this.isSwimming()) {
104-
* if (!this.isOnGround() && !this.input.sneaking && bl8 || !this.isTouchingWater()) {
105-
* this.setSprinting(false);
106-
* }
107-
* } else if (bl9) {
108-
* this.setSprinting(false);
109-
* }
110-
* }
111-
* }</pre>
78+
* Overwrites the movement packet update function to use our code
11279
*/
80+
@Inject(method = "sendMovementPackets", at = @At(value = "HEAD"), cancellable = true)
81+
void sendLambdaMovement(CallbackInfo ci) {
82+
ci.cancel();
83+
PlayerPacketManager.sendPlayerPackets();
84+
autoJumpEnabled = Lambda.getMc().options.getAutoJump().getValue();
85+
}
86+
87+
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;sendSneakingPacket()V"))
88+
void sendSneakingPacket(ClientPlayerEntity entity) {
89+
PlayerPacketManager.sendSneakPackets();
90+
}
91+
11392
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSprinting()Z"))
11493
boolean isSprinting(ClientPlayerEntity entity) {
11594
return EventFlow.post(new MovementEvent.Sprint(entity.isSprinting())).getSprint();
11695
}
11796

11897
@Inject(method = "isSneaking", at = @At(value = "HEAD"), cancellable = true)
119-
void redirectSneaking(CallbackInfoReturnable<Boolean> cir) {
98+
void injectSneakingInput(CallbackInfoReturnable<Boolean> cir) {
12099
ClientPlayerEntity self = (ClientPlayerEntity) (Object) this;
121100
if (self != Lambda.getMc().player) return;
122101

123102
if (self.input == null) return;
124103
cir.setReturnValue(EventFlow.post(new MovementEvent.Sneak(self.input.playerInput.sneak())).getSneak());
125104
}
126105

127-
/**
128-
* Overwrites the movement packet update function to use our code
129-
*/
130-
@Inject(method = "sendMovementPackets", at = @At(value = "HEAD"), cancellable = true)
131-
void sendBegin(CallbackInfo ci) {
132-
ci.cancel();
133-
PlayerPacketManager.sendPlayerPackets();
134-
autoJumpEnabled = Lambda.getMc().options.getAutoJump().getValue();
135-
}
136-
137106
@WrapMethod(method = "tick")
138107
void onTick(Operation<Void> original) {
139108
EventFlow.post(TickEvent.Player.Pre.INSTANCE);
@@ -170,7 +139,7 @@ private void adjustSwing(AbstractClientPlayerEntity instance, Hand hand) {
170139

171140
@Inject(method = "updateHealth", at = @At("HEAD"))
172141
public void damage(float health, CallbackInfo ci) {
173-
EventFlow.post(new PlayerEvent.Damage(health));
142+
EventFlow.post(new PlayerEvent.Health(health));
174143
}
175144

176145
/**

src/main/java/com/lambda/mixin/input/KeyboardMixin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.KeyboardEvent;
22+
import com.lambda.module.modules.player.InventoryMove;
2223
import net.minecraft.client.Keyboard;
24+
import net.minecraft.client.option.KeyBinding;
25+
import net.minecraft.client.util.InputUtil;
2326
import org.spongepowered.asm.mixin.Mixin;
2427
import org.spongepowered.asm.mixin.injection.At;
2528
import org.spongepowered.asm.mixin.injection.Inject;
@@ -32,6 +35,13 @@ private void onKey(long window, int key, int scancode, int action, int modifiers
3235
EventFlow.post(new KeyboardEvent.Press(key, scancode, action, modifiers));
3336
}
3437

38+
@Inject(method = "onKey", at = @At("RETURN"))
39+
private void onKeyTail(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) {
40+
if (!InventoryMove.getShouldMove() || !InventoryMove.isKeyMovementRelated(key)) return;
41+
InputUtil.Key fromCode = InputUtil.fromKeyCode(key, scancode);
42+
KeyBinding.setKeyPressed(fromCode, action != 0);
43+
}
44+
3545
@Inject(method = "onChar", at = @At("HEAD"))
3646
private void onChar(long window, int codePoint, int modifiers, CallbackInfo ci) {
3747
char[] chars = Character.toChars(codePoint);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import net.minecraft.block.BarrierBlock;
2222
import net.minecraft.block.BlockRenderType;
2323
import net.minecraft.block.BlockState;
24+
import net.minecraft.block.Blocks;
2425
import org.spongepowered.asm.mixin.Mixin;
2526
import org.spongepowered.asm.mixin.injection.At;
2627
import org.spongepowered.asm.mixin.injection.Inject;
@@ -33,10 +34,9 @@ public class BarrierBlockMixin {
3334
*/
3435
@Inject(method = "getRenderType", at = @At("RETURN"), cancellable = true)
3536
private void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
36-
// FixMe: This mixins fucks up the loading process by calling the configurations too early and doesn't load the settings
37-
/*if (BlockESP.INSTANCE.isEnabled()
37+
if (BlockESP.INSTANCE.isEnabled()
3838
&& BlockESP.getBarrier()
3939
&& state.getBlock() == Blocks.BARRIER
40-
) cir.setReturnValue(BlockRenderType.MODEL);*/
40+
) cir.setReturnValue(BlockRenderType.MODEL);
4141
}
4242
}

src/main/java/com/lambda/mixin/network/ClientConnectionMixin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.spongepowered.asm.mixin.Final;
3535
import org.spongepowered.asm.mixin.Mixin;
3636
import org.spongepowered.asm.mixin.Shadow;
37+
import org.spongepowered.asm.mixin.Unique;
3738
import org.spongepowered.asm.mixin.injection.At;
3839
import org.spongepowered.asm.mixin.injection.Inject;
3940
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -62,7 +63,7 @@ private void sendingPacketPost(Packet<?> packet, final CallbackInfo callbackInfo
6263
EventFlow.post(new PacketEvent.Send.Post((Packet<? extends ServerPlayPacketListener>) packet));
6364
}
6465

65-
@SuppressWarnings("all")
66+
@SuppressWarnings("unchecked")
6667
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V", shift = At.Shift.BEFORE), cancellable = true, require = 1)
6768
private void receivingPacket(
6869
ChannelHandlerContext channelHandlerContext,

0 commit comments

Comments
 (0)