Skip to content

Commit 84ad6be

Browse files
committed
Merge remote-tracking branch 'origin/1.21.5' into feature/more-freecam-features
# Conflicts: # src/main/kotlin/com/lambda/module/modules/player/Freecam.kt
2 parents 169308d + 1a0977b commit 84ad6be

File tree

271 files changed

+5390
-4473
lines changed

Some content is hidden

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

271 files changed

+5390
-4473
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ body:
2323
value: "The game should have loaded"
2424
validations:
2525
required: true
26-
- type: dropdown
26+
- type: input
2727
id: version
2828
attributes:
2929
label: Version
3030
description: What version of Lambda are you using?
31-
options:
32-
- 1.0.0
33-
default: 0
3431
validations:
3532
required: true
3633
- type: input

.github/workflows/build.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,10 @@ jobs:
2525
- name: Checkout Repository
2626
uses: actions/checkout@v4
2727

28-
- name: Get Short Commit Hash
29-
id: vars
30-
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
31-
3228
- name: Set-Up JDK
3329
uses: actions/setup-java@v4
3430
with:
35-
distribution: 'temurin'
31+
distribution: 'oracle'
3632
java-version: '21'
3733
architecture: x64
3834
cache: 'gradle'
@@ -44,24 +40,25 @@ jobs:
4440
file: gradle.properties
4541
all: true
4642

47-
- name: Publish commit to maven
48-
id: upload
49-
run: ./gradlew publish -PmavenType=snapshots -PcommitHash=${{ env.COMMIT_HASH }} -PmavenUsername=${{ secrets.MAVEN_USER }} -PmavenPassword=${{ secrets.MAVEN_TOKEN }}
50-
5143
- name: Publish snapshot to maven
44+
if: github.event_name == 'push'
5245
run: ./gradlew publish -PmavenType=snapshots -PcommitHash=SNAPSHOT -PmavenUsername=${{ secrets.MAVEN_USER }} -PmavenPassword=${{ secrets.MAVEN_TOKEN }}
5346

5447
- name: Generate Summary
55-
if: steps.upload.conclusion == 'success'
48+
if: steps.upload.conclusion == 'success' && github.event_name == 'push'
5649
run: |
5750
cat << EOF >> $GITHUB_STEP_SUMMARY
5851
### [Lambda ${{ steps.all.outputs.modVersion }} ${{ steps.all.outputs.minecraftVersion }} (${{ env.COMMIT_HASH }})](https://maven.lambda-client.org/snapshots/com/lambda/lambda/${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}/lambda-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar)
5952
EOF
6053
54+
- name: Rename jar
55+
if: steps.upload.conclusion == 'failure' || github.event_name == 'pull_request'
56+
run: mv /build/libs/lambda-fabric-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}.jar /build/libs/lambda-fabric-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar
57+
6158
- name: Failover Upload
62-
if: steps.upload.conclusion == 'failure'
59+
if: steps.upload.conclusion == 'failure' || github.event_name == 'pull_request'
6360
uses: actions/upload-artifact@v4
6461
with:
6562
name: lambda-nightly
6663
path: |
67-
/build/libs/lambda-*-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar
64+
/build/libs/lambda-fabric-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar

.idea/codeStyles/Project.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
# Lambda https://github.com/lambda-client/lambda
1919
modId=lambda
2020
modName=Lambda
21-
modVersion=1.0.0
21+
modVersion=0.0.1
2222
modDescription=Minecraft utility mod for automation
2323
modIcon=assets/lambda/lambda.png
2424
mavenGroup=com.lambda
25-
modAuthors=Avanatiker, Blade, beanbag44, Emy
25+
modAuthors=Constructor (Avanatiker), Blade, beanbag44, Emy
2626

2727
# General
2828
minecraftVersion=1.21.5

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
package com.lambda.mixin;
1919

2020
import com.lambda.Lambda;
21-
import com.lambda.config.AbstractSetting;
21+
import com.lambda.config.Setting;
2222
import com.lambda.module.Module;
2323
import com.lambda.module.ModuleRegistry;
24-
import com.lambda.util.DynamicException;
24+
import com.lambda.util.DynamicExceptionKt;
2525
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
2626
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2727
import net.minecraft.client.MinecraftClient;
@@ -47,7 +47,7 @@ public class CrashReportMixin {
4747
@Inject(method = "<init>(Ljava/lang/String;Ljava/lang/Throwable;)V", at = @At("TAIL"))
4848
void injectConstructor(String message, Throwable cause, CallbackInfo ci) {
4949
if (!Lambda.INSTANCE.isDebug() && MinecraftClient.getInstance() != null) {
50-
this.cause = new DynamicException(cause);
50+
this.cause = DynamicExceptionKt.dynamicException(cause);
5151
}
5252
}
5353

@@ -67,7 +67,7 @@ String injectString(ReportType type, List<String> extraInfo, Operation<String> o
6767

6868
module.getSettings()
6969
.stream()
70-
.filter(AbstractSetting::isModified)
70+
.filter(Setting::isModified)
7171
.forEach(setting -> list.add(String.format("\t\t%s -> %s", setting.getName(), setting.getValue())));
7272
});
7373
}

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

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
import com.lambda.event.events.TickEvent;
2525
import com.lambda.gui.DearImGui;
2626
import com.lambda.gui.components.ClickGuiLayout;
27+
import com.lambda.module.modules.movement.BetterFirework;
2728
import com.lambda.module.modules.player.Interact;
2829
import com.lambda.module.modules.player.InventoryMove;
2930
import com.lambda.module.modules.player.PacketMine;
3031
import com.lambda.util.WindowUtils;
32+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
33+
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
3134
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
3235
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
3336
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
@@ -48,7 +51,6 @@
4851
import org.spongepowered.asm.mixin.Unique;
4952
import org.spongepowered.asm.mixin.injection.At;
5053
import org.spongepowered.asm.mixin.injection.Inject;
51-
import org.spongepowered.asm.mixin.injection.Redirect;
5254
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
5355

5456
@Mixin(value = MinecraftClient.class, priority = Integer.MAX_VALUE)
@@ -153,10 +155,10 @@ private void onScreenRemove(@Nullable Screen screen, CallbackInfo ci) {
153155
}
154156
}
155157

156-
@Redirect(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V"))
157-
private void redirectUnPressAll() {
158+
@WrapOperation(method = "setScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;unpressAll()V"))
159+
private void redirectUnPressAll(Operation<Void> original) {
158160
if (!InventoryMove.getShouldMove()) {
159-
KeyBinding.unpressAll();
161+
original.call();
160162
return;
161163
}
162164
KeyBinding.KEYS_BY_ID.values().forEach(bind -> {
@@ -166,20 +168,16 @@ private void redirectUnPressAll() {
166168
});
167169
}
168170

169-
@Redirect(method = "doAttack()Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
170-
private void redirectHandSwing(ClientPlayerEntity instance, Hand hand) {
171-
if (this.crosshairTarget == null) return;
172-
if (this.crosshairTarget.getType() != HitResult.Type.BLOCK || PacketMine.INSTANCE.isDisabled()) {
173-
instance.swingHand(hand);
174-
}
171+
@WrapWithCondition(method = "doAttack()Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;swingHand(Lnet/minecraft/util/Hand;)V"))
172+
private boolean redirectHandSwing(ClientPlayerEntity instance, Hand hand) {
173+
if (this.crosshairTarget == null) return false;
174+
return this.crosshairTarget.getType() != HitResult.Type.BLOCK || PacketMine.INSTANCE.isDisabled();
175175
}
176176

177-
@Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z"))
178-
boolean redirectMultiActon(ClientPlayerInteractionManager instance) {
179-
if (instance == null) return true;
180-
177+
@ModifyExpressionValue(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z"))
178+
boolean redirectMultiActon(boolean original) {
181179
if (Interact.INSTANCE.isEnabled() && Interact.getMultiAction()) return false;
182-
return instance.isBreakingBlock();
180+
return original;
183181
}
184182

185183
@Inject(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isRiding()Z"))
@@ -189,6 +187,18 @@ void injectFastPlace(CallbackInfo ci) {
189187
itemUseCooldown = Interact.getPlaceDelay();
190188
}
191189

190+
@WrapMethod(method = "doItemUse")
191+
void injectItemUse(Operation<Void> original) {
192+
if (BetterFirework.INSTANCE.isDisabled() || !BetterFirework.onInteract())
193+
original.call();
194+
}
195+
196+
@WrapMethod(method = "doItemPick")
197+
void injectItemPick(Operation<Void> original) {
198+
if (BetterFirework.INSTANCE.isDisabled() || !BetterFirework.onPick())
199+
original.call();
200+
}
201+
192202
@WrapMethod(method = "getTargetMillisPerTick")
193203
float getTargetMillisPerTick(float millis, Operation<Float> original) {
194204
var length = TimerManager.INSTANCE.getLength();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import baritone.api.utils.Rotation;
2222
import baritone.utils.player.BaritonePlayerContext;
2323
import com.lambda.interaction.BaritoneManager;
24-
import com.lambda.interaction.request.rotating.RotationManager;
24+
import com.lambda.interaction.managers.rotating.RotationManager;
2525
import org.spongepowered.asm.mixin.Final;
2626
import org.spongepowered.asm.mixin.Mixin;
2727
import org.spongepowered.asm.mixin.Shadow;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import baritone.api.utils.Rotation;
2323
import baritone.behavior.LookBehavior;
2424
import com.lambda.interaction.BaritoneManager;
25-
import com.lambda.interaction.request.rotating.RotationManager;
25+
import com.lambda.interaction.managers.rotating.RotationManager;
2626
import org.spongepowered.asm.mixin.Mixin;
2727
import org.spongepowered.asm.mixin.injection.At;
2828
import org.spongepowered.asm.mixin.injection.Inject;

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@
2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.InventoryEvent;
2222
import com.lambda.event.events.PlayerEvent;
23+
import com.lambda.interaction.managers.inventory.InventoryManager;
24+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
25+
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
26+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2327
import net.minecraft.client.network.ClientPlayerEntity;
2428
import net.minecraft.client.network.ClientPlayerInteractionManager;
29+
import net.minecraft.client.recipebook.ClientRecipeBook;
30+
import net.minecraft.client.world.ClientWorld;
2531
import net.minecraft.entity.Entity;
2632
import net.minecraft.entity.player.PlayerEntity;
2733
import net.minecraft.entity.player.PlayerInventory;
2834
import net.minecraft.screen.slot.SlotActionType;
35+
import net.minecraft.stat.StatHandler;
2936
import net.minecraft.util.ActionResult;
3037
import net.minecraft.util.Hand;
3138
import net.minecraft.util.hit.BlockHitResult;
@@ -36,13 +43,11 @@
3643
import org.spongepowered.asm.mixin.Shadow;
3744
import org.spongepowered.asm.mixin.injection.At;
3845
import org.spongepowered.asm.mixin.injection.Inject;
39-
import org.spongepowered.asm.mixin.injection.Redirect;
4046
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
4147
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
4248

4349
@Mixin(ClientPlayerInteractionManager.class)
4450
public class ClientPlayInteractionManagerMixin {
45-
4651
@Shadow
4752
public float currentBreakingProgress;
4853

@@ -98,9 +103,9 @@ public void clickSlotHead(int syncId, int slotId, int button, SlotActionType act
98103
* }
99104
* }</pre>
100105
*/
101-
@Redirect(method = "syncSelectedSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;getSelectedSlot()I"))
102-
public int overrideSelectedSlotSync(PlayerInventory instance) {
103-
return EventFlow.post(new InventoryEvent.HotbarSlot.Update(instance.getSelectedSlot())).getSlot();
106+
@ModifyExpressionValue(method = "syncSelectedSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;getSelectedSlot()I"))
107+
public int overrideSelectedSlotSync(int original) {
108+
return EventFlow.post(new InventoryEvent.HotbarSlot.Update(original)).getSlot();
104109
}
105110

106111
@Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"), cancellable = true)
@@ -115,4 +120,11 @@ private void updateBlockBreakingProgressPre(BlockPos pos, Direction side, Callba
115120
private void cancelBlockBreakingPre(CallbackInfo ci) {
116121
if (EventFlow.post(new PlayerEvent.Breaking.Cancel(currentBreakingProgress)).isCanceled()) ci.cancel();
117122
}
123+
124+
@WrapMethod(method = "createPlayer(Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/stat/StatHandler;Lnet/minecraft/client/recipebook/ClientRecipeBook;ZZ)Lnet/minecraft/client/network/ClientPlayerEntity;")
125+
private ClientPlayerEntity injectCreatePlayer(ClientWorld world, StatHandler statHandler, ClientRecipeBook recipeBook, boolean lastSneaking, boolean lastSprinting, Operation<ClientPlayerEntity> original) {
126+
var player = original.call(world, statHandler, recipeBook, lastSneaking, lastSprinting);
127+
InventoryManager.INSTANCE.setScreenHandler(player.playerScreenHandler);
128+
return player;
129+
}
118130
}

0 commit comments

Comments
 (0)