Skip to content

Commit 8ac5452

Browse files
committed
Merge branch 'master' into feature/viewmodel
2 parents 8f54315 + b5bec2d commit 8ac5452

Some content is hidden

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

59 files changed

+1284
-2041
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] 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] Feat: "
4-
assignees:
5-
- Edouard127
3+
title: "Feat: "
64
body:
75
- type: markdown
86
attributes:

.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.
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/kotlin/com/lambda/command/commands/CapeCommand.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.lambda.brigadier.argument.value
2323
import com.lambda.brigadier.execute
2424
import com.lambda.brigadier.required
2525
import com.lambda.command.LambdaCommand
26+
import com.lambda.network.CapeManager
2627
import com.lambda.network.CapeManager.updateCape
2728
import com.lambda.network.NetworkManager
2829
import com.lambda.util.Communication.info
@@ -38,7 +39,7 @@ object CapeCommand : LambdaCommand(
3839
required(literal("set")) {
3940
required(string("id")) { id ->
4041
suggests { _, builder ->
41-
NetworkManager.capes
42+
CapeManager.capeList
4243
.forEach { builder.suggest(it) }
4344

4445
builder.buildFuture()

common/src/main/kotlin/com/lambda/command/commands/FriendCommand.kt

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ import com.lambda.brigadier.required
3030
import com.lambda.command.LambdaCommand
3131
import com.lambda.config.configurations.FriendConfig
3232
import com.lambda.friend.FriendManager
33+
import com.lambda.network.mojang.getProfile
3334
import com.lambda.util.Communication.info
3435
import com.lambda.util.extension.CommandBuilder
3536
import com.lambda.util.text.ClickEvents
3637
import com.lambda.util.text.buildText
3738
import com.lambda.util.text.literal
3839
import com.lambda.util.text.styled
40+
import kotlinx.coroutines.runBlocking
3941
import java.awt.Color
4042

4143
object FriendCommand : LambdaCommand(
@@ -82,19 +84,24 @@ object FriendCommand : LambdaCommand(
8284
}
8385

8486
executeWithResult {
85-
val name = player().value()
86-
val id = mc.networkHandler
87-
?.playerList
88-
?.firstOrNull {
89-
it.profile.name == name &&
90-
it.profile != mc.gameProfile
91-
} ?: return@executeWithResult failure("Could not find the player on the server")
92-
93-
return@executeWithResult if (FriendManager.befriend(id.profile)) {
94-
this@FriendCommand.info(FriendManager.befriendedText(id.profile.name))
95-
success()
96-
} else {
97-
failure("This player is already in your friend list")
87+
runBlocking {
88+
val name = player().value()
89+
90+
if (mc.gameProfile.name == name) return@runBlocking failure("You can't befriend yourself")
91+
92+
val profile = mc.networkHandler
93+
?.playerList
94+
?.map { it.profile }
95+
?.firstOrNull { it.name == name }
96+
?: getProfile(name)
97+
.getOrElse { return@runBlocking failure("Could not find the player") }
98+
99+
return@runBlocking if (FriendManager.befriend(profile)) {
100+
info(FriendManager.befriendedText(profile.name))
101+
success()
102+
} else {
103+
failure("This player is already in your friend list")
104+
}
98105
}
99106
}
100107
}
@@ -111,18 +118,24 @@ object FriendCommand : LambdaCommand(
111118
}
112119

113120
executeWithResult {
114-
val uuid = player().value()
115-
val id = mc.networkHandler
116-
?.playerList
117-
?.firstOrNull {
118-
it.profile.id == uuid && it.profile != mc.gameProfile
119-
} ?: return@executeWithResult failure("Could not find the player on the server")
120-
121-
return@executeWithResult if (FriendManager.befriend(id.profile)) {
122-
this@FriendCommand.info(FriendManager.befriendedText(id.profile.name))
123-
success()
124-
} else {
125-
failure("This player is already in your friend list")
121+
runBlocking {
122+
val uuid = player().value()
123+
124+
if (mc.gameProfile.id == uuid) return@runBlocking failure("You can't befriend yourself")
125+
126+
val profile = mc.networkHandler
127+
?.playerList
128+
?.map { it.profile }
129+
?.firstOrNull { it.id == uuid }
130+
?: getProfile(uuid)
131+
.getOrElse { return@runBlocking failure("Could not find the player") }
132+
133+
return@runBlocking if (FriendManager.befriend(profile)) {
134+
this@FriendCommand.info(FriendManager.befriendedText(profile.name))
135+
success()
136+
} else {
137+
failure("This player is already in your friend list")
138+
}
126139
}
127140
}
128141
}

common/src/main/kotlin/com/lambda/command/commands/ReplayCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import com.lambda.brigadier.executeWithResult
2727
import com.lambda.brigadier.required
2828
import com.lambda.command.LambdaCommand
2929
import com.lambda.module.modules.player.Replay
30+
import com.lambda.util.FileUtils.listRecursive
3031
import com.lambda.util.FolderRegister
31-
import com.lambda.util.FolderRegister.listRecursive
3232
import com.lambda.util.extension.CommandBuilder
3333
import kotlin.io.path.exists
3434

0 commit comments

Comments
 (0)