Skip to content

Commit 30dd2c6

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/pathfinder
2 parents 63bc635 + 1c4e8ea commit 30dd2c6

Some content is hidden

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

55 files changed

+1096
-435
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Bug Report
22
description: File a bug report.
3-
title: "[Version] [Mod loader] Bug: "
3+
title: "[Version] Bug: "
44
assignees:
55
- Edouard127
66
body:

.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Feature
22
description: Request or implement a feature.
3-
title: "[Version] [Mod loader] Feat: "
3+
title: "[Version] Feat: "
44
assignees:
55
- Edouard127
66
body:

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
blank_issues_enabled: false
1+
blank_issues_enabled: true
22
contact_links:
33
- name: Lambda Discord Server
44
url: https://discord.gg/QjfBxJzE5x

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ val Project.loom: LoomGradleExtensionAPI
3838
get() = (this as ExtensionAware).extensions.getByName("loom") as LoomGradleExtensionAPI
3939

4040
plugins {
41-
kotlin("jvm") version "2.0.20"
42-
id("org.jetbrains.dokka") version "1.9.20"
41+
kotlin("jvm") version "2.1.20"
42+
id("org.jetbrains.dokka") version "2.0.0"
4343
id("architectury-plugin") version "3.4-SNAPSHOT"
44-
id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false
44+
id("dev.architectury.loom") version "1.9-SNAPSHOT" apply false
4545
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
4646
id("maven-publish")
4747
}

common/build.gradle.kts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ val modId: String by project
2121
val fabricLoaderVersion: String by project
2222
val kotlinxCoroutinesVersion: String by project
2323
val discordIPCVersion: String by project
24-
val fuelVersion: String by project
25-
val resultVersion: String by project
24+
val ktorVersion: String by project
2625
val mockitoKotlin: String by project
2726
val mockitoInline: String by project
2827
val mockkVersion: String by project
@@ -50,16 +49,19 @@ dependencies {
5049
implementation("com.github.Edouard127:KDiscordIPC:$discordIPCVersion")
5150
implementation("com.pngencoder:pngencoder:0.15.0")
5251

53-
// Fuel HTTP library and dependencies
54-
implementation("com.github.kittinunf.fuel:fuel:$fuelVersion")
55-
implementation("com.github.kittinunf.fuel:fuel-gson:$fuelVersion")
56-
implementation("com.github.kittinunf.result:result-jvm:$resultVersion")
52+
// Ktor
53+
implementation("io.ktor:ktor-client-core:$ktorVersion")
54+
implementation("io.ktor:ktor-client-cio:$ktorVersion")
55+
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
56+
implementation("io.ktor:ktor-serialization-gson:$ktorVersion")
5757

5858
// Add Kotlin
5959
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
6060

6161
// Baritone
6262
modImplementation("baritone-api:baritone-unoptimized-fabric:1.10.2") { isTransitive = false }
63+
64+
// Test implementations
6365
testImplementation(kotlin("test"))
6466
testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoKotlin")
6567
testImplementation("org.mockito:mockito-inline:$mockitoInline")
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.mixin;
19+
20+
import com.lambda.Lambda;
21+
import com.lambda.module.Module;
22+
import com.lambda.module.ModuleRegistry;
23+
import com.lambda.util.DynamicException;
24+
import net.minecraft.client.MinecraftClient;
25+
import net.minecraft.util.Util;
26+
import net.minecraft.util.crash.CrashReport;
27+
import org.spongepowered.asm.mixin.Final;
28+
import org.spongepowered.asm.mixin.Mixin;
29+
import org.spongepowered.asm.mixin.Mutable;
30+
import org.spongepowered.asm.mixin.Shadow;
31+
import org.spongepowered.asm.mixin.injection.At;
32+
import org.spongepowered.asm.mixin.injection.Inject;
33+
import org.spongepowered.asm.mixin.injection.Redirect;
34+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
35+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
36+
37+
// Modify the crash report behavior for dynamic remapping, Easter egg and github issue link
38+
@Mixin(CrashReport.class)
39+
public class CrashReportMixin {
40+
@Mutable
41+
@Shadow @Final private Throwable cause;
42+
43+
@Inject(method = "<init>(Ljava/lang/String;Ljava/lang/Throwable;)V", at = @At("TAIL"))
44+
void injectConstructor(String message, Throwable cause, CallbackInfo ci) {
45+
if (!Lambda.INSTANCE.isDebug() && MinecraftClient.getInstance() != null) {
46+
this.cause = new DynamicException(cause);
47+
}
48+
}
49+
50+
@Redirect(method = "asString()Ljava/lang/String;", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/crash/CrashReport;addStackTrace(Ljava/lang/StringBuilder;)V"))
51+
void injectString(CrashReport instance, StringBuilder stringBuilder) {
52+
stringBuilder.append("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");
53+
54+
if (MinecraftClient.getInstance() != null) {
55+
stringBuilder.append("Enabled modules:\n");
56+
57+
ModuleRegistry.INSTANCE.getModules()
58+
.stream().filter(Module::isEnabled)
59+
.forEach(m -> stringBuilder.append("\t").append(m.getName()).append("\n"));
60+
}
61+
62+
stringBuilder.append("\n");
63+
stringBuilder.append("-".repeat(43));
64+
stringBuilder.append("\n\n");
65+
66+
instance.addStackTrace(stringBuilder);
67+
}
68+
69+
@Inject(method = "generateWittyComment()Ljava/lang/String;", at = @At("HEAD"), cancellable = true)
70+
private static void generateWittyComment(CallbackInfoReturnable<String> cir) {
71+
String[] strings = new String[]{"Who set us up the TNT?", "Everything's going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I'm sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don't be sad. I'll do better next time, I promise!", "Don't be sad, have a hug! <3", "I just don't know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn't worry myself about that.", "I bet Cylons wouldn't have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I'm Minecraft, and I'm a crashaholic.", "Ooh. Shiny.", "This doesn't make any sense!", "Why is it breaking :(", "Don't do that.", "Ouch. That hurt :(", "You're mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!", "But it works on my machine.", "Popbob was here.", "The oldest anarchy server in Minecraft.", "Better luck next time..", "Fatal error occurred user is too based.", "Running premium software on a potato is not advised", "I don't know, ask that kilab guy", "Ah shit, here we go again.", "I will uhh, fix that sometime.", "Not a bug, a feature!", "You should try out Lambda on Windows XP.", "Blade did that."};
72+
73+
try {
74+
cir.setReturnValue(strings[(int)(Util.getMeasuringTimeNano() % (long)strings.length)]);
75+
} catch (Throwable var2) {
76+
cir.setReturnValue("Witty comment unavailable :(");
77+
}
78+
}
79+
}

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@
2424
import com.lambda.event.events.TickEvent;
2525
import com.lambda.interaction.PlayerPacketManager;
2626
import com.lambda.interaction.request.rotation.RotationManager;
27+
import com.lambda.module.modules.player.PortalGui;
28+
import net.minecraft.client.MinecraftClient;
29+
import net.minecraft.client.gui.screen.DeathScreen;
30+
import net.minecraft.client.gui.screen.Screen;
31+
import net.minecraft.client.gui.screen.ingame.HandledScreen;
2732
import net.minecraft.client.input.Input;
2833
import net.minecraft.client.network.ClientPlayerEntity;
2934
import net.minecraft.entity.MovementType;
3035
import net.minecraft.entity.damage.DamageSource;
3136
import net.minecraft.util.Hand;
3237
import net.minecraft.util.math.Vec3d;
38+
import org.spongepowered.asm.mixin.Final;
3339
import org.spongepowered.asm.mixin.Mixin;
3440
import org.spongepowered.asm.mixin.Shadow;
3541
import org.spongepowered.asm.mixin.injection.At;
@@ -51,6 +57,8 @@ public abstract class ClientPlayerEntityMixin extends EntityMixin {
5157
@Shadow
5258
protected abstract void autoJump(float dx, float dz);
5359

60+
@Shadow @Final protected MinecraftClient client;
61+
5462
/**
5563
* Post movement events and applies the modified player velocity
5664
*/
@@ -150,4 +158,22 @@ void onSwingHandPre(Hand hand, CallbackInfo ci) {
150158
public void damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
151159
if (EventFlow.post(new PlayerEvent.Damage(source, amount)).isCanceled()) cir.setReturnValue(false);
152160
}
161+
162+
/**
163+
* Prevents the game from closing Guis when the player is in a nether portal
164+
* <pre>{@code
165+
* if (this.client.currentScreen != null && !this.client.currentScreen.shouldPause() && !(this.client.currentScreen instanceof DeathScreen)) {
166+
* if (this.client.currentScreen instanceof HandledScreen) {
167+
* this.closeHandledScreen();
168+
* }
169+
*
170+
* this.client.setScreen((Screen)null);
171+
* }
172+
* }</pre>
173+
*/
174+
@Redirect(method = "updateNausea", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;"))
175+
Screen keepScreensInPortal(MinecraftClient instance) {
176+
if (PortalGui.INSTANCE.isEnabled()) return null;
177+
else return client.currentScreen;
178+
}
153179
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private void changeLookDirection(double cursorDeltaX, double cursorDeltaY, Callb
130130
@Inject(method = "onTrackedDataSet(Lnet/minecraft/entity/data/TrackedData;)V", at = @At("TAIL"))
131131
public void onTrackedDataSet(TrackedData<?> data, CallbackInfo ci) {
132132
Entity entity = (Entity) (Object) this;
133-
EventFlow.post(new EntityEvent.EntityUpdate(entity, data));
133+
EventFlow.post(new EntityEvent.Update(entity, data));
134134
}
135135

136136
// ToDo: Does not trigger for some reason.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public class KeyboardMixin {
3030
@Inject(method = "onKey", at = @At("HEAD"))
3131
private void onKey(long window, int key, int scancode, int action, int modifiers, CallbackInfo ci) {
3232
if (key <= 0) return;
33-
if (action != 1) return; // TODO: Post events on both press and release ?
34-
3533
EventFlow.post(new KeyboardEvent.Press(key, scancode, action, modifiers));
3634
}
3735

common/src/main/java/com/lambda/mixin/world/ClientWorldMixin.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@
2323
import com.lambda.module.modules.render.WorldColors;
2424
import com.lambda.util.math.ColorKt;
2525
import net.minecraft.block.BlockState;
26-
import net.minecraft.client.network.ClientPlayNetworkHandler;
27-
import net.minecraft.client.render.WorldRenderer;
2826
import net.minecraft.client.world.ClientWorld;
2927
import net.minecraft.entity.Entity;
30-
import net.minecraft.registry.RegistryKey;
31-
import net.minecraft.registry.entry.RegistryEntry;
3228
import net.minecraft.util.math.BlockPos;
3329
import net.minecraft.util.math.Vec3d;
3430
import org.spongepowered.asm.mixin.Mixin;
@@ -37,20 +33,18 @@
3733
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3834
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
3935

40-
import java.util.function.Supplier;
41-
4236
@Mixin(ClientWorld.class)
4337
public class ClientWorldMixin {
4438
@Inject(method = "addEntity", at = @At("HEAD"), cancellable = true)
4539
private void onAddEntity(Entity entity, CallbackInfo ci) {
46-
if (EventFlow.post(new EntityEvent.EntitySpawn(entity)).isCanceled()) ci.cancel();
40+
if (EventFlow.post(new EntityEvent.Spawn(entity)).isCanceled()) ci.cancel();
4741
}
4842

4943
@Inject(method = "removeEntity", at = @At("HEAD"))
5044
private void onRemoveEntity(int entityId, Entity.RemovalReason removalReason, CallbackInfo ci) {
5145
Entity entity = ((ClientWorld) (Object) this).getEntityById(entityId);
5246
if (entity == null) return;
53-
EventFlow.post(new EntityEvent.EntityRemoval(entity, removalReason));
47+
EventFlow.post(new EntityEvent.Removal(entity, removalReason));
5448
}
5549

5650
@Inject(method = "getCloudsColor", at = @At("HEAD"), cancellable = true)

0 commit comments

Comments
 (0)