Skip to content

Commit 42ae224

Browse files
committed
Merge branch 'master' into 1.21.5
2 parents 6526138 + 2d3ed02 commit 42ae224

File tree

237 files changed

+7199
-4773
lines changed

Some content is hidden

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

237 files changed

+7199
-4773
lines changed

.coderabbit.yaml

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

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Bug Report
22
description: File a bug report.
3-
title: "[Version] [Mod loader] Bug: "
4-
assignees:
5-
- Edouard127
3+
title: "Bug: "
64
body:
75
- type: markdown
86
attributes:

.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Feature
22
description: Request or implement a feature.
3-
title: "[Version] [Mod loader] Feat: "
4-
assignees:
5-
- Edouard127
3+
title: "Feat: "
64
body:
75
- type: markdown
86
attributes:

.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

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
### This is a template, modify before submitting your PR
44

5-
Please ensure that your PR title follows this format:
6-
- `[Minecraft Version] <Mod loader> Feat, Fix, Ref, Docs, ..., : Description`
5+
Ensure that your title is concise and has all the necessary information
76

87
**Examples:**
9-
- `[1.20.4] Feat: Add new block types`
10-
- `[1.21.4] [All] Fix: Crash on startup`
11-
- `[1.21.3] [Forge] Fix: GUI does not render`
12-
- `[1.20.1] Ref: Optimize rendering engine`
8+
- `Feat: Add new block types`
9+
- `Fix: Crash on startup`
10+
- `Fix: GUI does not render`
11+
- `Ref: Optimize rendering engine`
12+
- `New pre-processor for pathfinding`
13+
- `Fix inconsistency with the structure`
1314

1415
### Issue Link
1516
If your PR addresses one or more issues, be sure to link them. Use appropriate keywords like `closes`, `fixes`, or `resolves` to automatically close the linked issues when the PR is merged.

.github/workflows/build.yml

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,26 @@ name: Build Lambda
33
on:
44
push:
55
branches:
6-
- '**'
6+
- 'master'
7+
pull_request:
78

89
jobs:
9-
check-runner:
10-
name: Check Runner Availability
11-
runs-on: ubuntu-latest
12-
13-
outputs:
14-
runner-label: ${{ steps.set-runner.outputs.runner-label }}
15-
16-
steps:
17-
- name: Set runner
18-
id: set-runner
19-
run: |
20-
runners=$(curl -v -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.REPO_ACCESS_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners" --http1.1)
21-
if [ $? -ne 0 ]; then
22-
echo "Error: Failed to fetch runners from GitHub API" >&2
23-
exit 1
24-
fi
25-
26-
runners_count=$(echo "$runners" | jq '.runners | length')
27-
if [ "$runners_count" -eq 0 ]; then
28-
echo "No runners available or failed to retrieve runners." >&2
29-
echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
30-
exit 0
31-
fi
32-
33-
available=$(echo "$runners" | jq '.runners[] | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")')
34-
if [ $? -ne 0 ]; then
35-
echo "Error: Failed to parse JSON response" >&2
36-
exit 1
37-
fi
38-
39-
if [ -n "$available" ]; then
40-
echo "runner-label=lambda-linux-runner" >> $GITHUB_OUTPUT
41-
else
42-
echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
43-
fi
4410
build:
4511
concurrency:
4612
group: ${{ github.workflow }}-${{ github.ref }}
4713
cancel-in-progress: true
48-
49-
needs: check-runner
50-
runs-on: ${{ needs.check-runner.outputs.runner-label }}
5114

5215
name: Build Lambda
16+
runs-on: ubuntu-latest
17+
5318
permissions:
5419
contents: write
20+
5521
env:
5622
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
5723
steps:
5824
- name: Checkout Repository
59-
uses: actions/checkout@v4.1.1
25+
uses: actions/checkout@v4
6026

6127
- name: Set current date as env variable
6228
run: echo "DATE=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
@@ -65,11 +31,11 @@ jobs:
6531
id: vars
6632
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
6733

68-
- name: Set-Up JDK 17
34+
- name: Set-Up JDK
6935
uses: actions/setup-java@v4
7036
with:
7137
distribution: 'temurin'
72-
java-version: '17'
38+
java-version: '21'
7339
architecture: x64
7440
cache: 'gradle'
7541

@@ -81,7 +47,7 @@ jobs:
8147
all: true
8248

8349
- name: Build Lambda
84-
run: ./gradlew build
50+
run: ./gradlew build --no-daemon
8551

8652
- name: Rename Files with Commit Hash
8753
run: |
@@ -111,8 +77,6 @@ jobs:
11177
### [Lambda Forge ${{ steps.all.outputs.modVersion }} ${{ steps.all.outputs.minecraftVersion }} (${{ env.COMMIT_HASH }})](https://r2-bucket.edouard127.christmas/${{ env.DATE }}-${{ env.COMMIT_HASH }}/lambda-forge-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar)
11278
11379
#### [API (Developer Dependency)](https://r2-bucket.edouard127.christmas/${{ env.DATE }}-${{ env.COMMIT_HASH }}/lambda-api-${{ steps.all.outputs.modVersion }}+${{ steps.all.outputs.minecraftVersion }}-${{ env.COMMIT_HASH }}.jar)
114-
115-
**Runner:** \`${{ needs.check-runner.outputs.runner-label }}\`
11680
EOF
11781
11882
- name: Failover Upload

.github/workflows/publish-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Publish Dokka Documentation
22

33
on:
44
push:
5-
branches:
6-
- 'master'
5+
tags:
6+
- '*'
77

88
jobs:
99
build:

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ subprojects {
8787

8888
loom.runs {
8989
all {
90-
property("lambda.dev", "youtu.be/7iNbnineUCI")
90+
property("lambda.dev", "youtu.be/RYnFIRc0k6E")
9191
}
9292
}
9393

common/build.gradle.kts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ val fabricLoaderVersion: String by project
2222
val kotlinxCoroutinesVersion: String by project
2323
val discordIPCVersion: String by project
2424
val baritoneVersion: String by project
25-
val fuelVersion: String by project
26-
val resultVersion: String by project
25+
val ktorVersion: String by project
26+
val mockitoKotlin: String by project
27+
val mockitoInline: String by project
28+
val mockkVersion: String by project
2729

2830
base.archivesName = "${base.archivesName.get()}-api"
2931

@@ -48,16 +50,23 @@ dependencies {
4850
implementation("com.github.Edouard127:KDiscordIPC:$discordIPCVersion")
4951
implementation("com.pngencoder:pngencoder:0.15.0")
5052

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

5659
// Add Kotlin
5760
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
5861

5962
// Baritone
60-
modImplementation("baritone-api:baritone-unoptimized-fabric:$baritoneVersion") { isTransitive = false }
63+
modImplementation("baritone-api:baritone-unoptimized-fabric:1.10.2") { isTransitive = false }
64+
65+
// Test implementations
66+
testImplementation(kotlin("test"))
67+
testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoKotlin")
68+
testImplementation("org.mockito:mockito-inline:$mockitoInline")
69+
testImplementation("io.mockk:mockk:${mockkVersion}")
6170
}
6271

6372
tasks {
@@ -67,5 +76,12 @@ tasks {
6776

6877
test {
6978
useJUnitPlatform()
79+
jvmArgs("-XX:+EnableDynamicAgentLoading", "-Xshare:off")
80+
}
81+
}
82+
83+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
84+
kotlinOptions {
85+
jvmTarget = "17"
7086
}
7187
}
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+
}

0 commit comments

Comments
 (0)