Skip to content

Commit 023d6e6

Browse files
committed
Merge branch '1.21.5' into feature/packetmine-rewrite
2 parents df89d64 + d7a6e73 commit 023d6e6

File tree

443 files changed

+2656
-2688
lines changed

Some content is hidden

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

443 files changed

+2656
-2688
lines changed

build.gradle.kts

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -17,9 +17,6 @@
1717

1818
import org.gradle.internal.jvm.*
1919
import net.fabricmc.loom.api.LoomGradleExtensionAPI
20-
import org.apache.tools.ant.taskdefs.condition.Os
21-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
22-
import java.io.FileNotFoundException
2320
import java.util.*
2421

2522
val modId: String by project
@@ -38,11 +35,11 @@ val Project.loom: LoomGradleExtensionAPI
3835
get() = (this as ExtensionAware).extensions.getByName("loom") as LoomGradleExtensionAPI
3936

4037
plugins {
41-
kotlin("jvm") version "2.1.20"
38+
kotlin("jvm") version "2.1.10"
4239
id("org.jetbrains.dokka") version "2.0.0"
4340
id("architectury-plugin") version "3.4-SNAPSHOT"
44-
id("dev.architectury.loom") version "1.9-SNAPSHOT" apply false
45-
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
41+
id("dev.architectury.loom") version "1.10-SNAPSHOT" apply false
42+
id("com.gradleup.shadow") version "9.0.0-beta13" apply false
4643
id("maven-publish")
4744
}
4845

@@ -57,7 +54,10 @@ subprojects {
5754

5855
dependencies {
5956
"minecraft"("com.mojang:minecraft:$minecraftVersion")
60-
"mappings"("net.fabricmc:yarn:$minecraftVersion+$yarnMappings:v2")
57+
"mappings"(loom.layered {
58+
mappings("net.fabricmc:yarn:$minecraftVersion+$yarnMappings:v2")
59+
mappings("dev.architectury:yarn-mappings-patch-neoforge:1.21+build.4")
60+
})
6161
}
6262

6363
publishing {
@@ -85,33 +85,44 @@ subprojects {
8585

8686
if (path == ":common") return@subprojects
8787

88+
loom.mods {
89+
maybeCreate("main").apply {
90+
sourceSet(project.sourceSets.main.get())
91+
sourceSet(project(":common").sourceSets.main.get())
92+
}
93+
}
94+
8895
loom.runs {
8996
all {
9097
property("lambda.dev", "youtu.be/RYnFIRc0k6E")
98+
property("org.lwjgl.util.Debug", "true")
99+
100+
vmArgs("-XX:+HeapDumpOnOutOfMemoryError", "-XX:+CreateCoredumpOnCrash", "-XX:+UseOSErrorReporting")
101+
programArgs("--username", "Steve", "--uuid", "8667ba71b85a4004af54457a9734eed7", "--accessToken", "****", "--userType", "msa")
91102
}
92103
}
93104

94105
tasks {
106+
processResources {
107+
// Replaces placeholders in the mod info files
108+
filesMatching(targets) { expand(replacements) }
109+
110+
// Forces the task to always run
111+
outputs.upToDateWhen { false }
112+
}
113+
95114
register<Exec>("renderDoc") {
96115
val javaHome = Jvm.current().javaHome
97116
val gradleWrapper = rootProject.tasks.wrapper.get().jarFile.absolutePath
98117

99118
commandLine = listOf(
100-
findExecutable("renderdoccmd")
101-
?: throw FileNotFoundException("Could not find the renderdoccmd executable"),
102-
"capture", /* Remove the following 2 lines if you don't want api validation */ "--opt-api-validation", "--opt-api-validation-unmute", "--opt-hook-children", "--wait-for-exit", "--working-dir", ".", "$javaHome/bin/java", "-Xmx64m", "-Xms64m", /*"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005",*/ "-Dorg.gradle.appname=gradlew", "-Dorg.gradle.java.home=$javaHome", "-classpath", gradleWrapper, "org.gradle.wrapper.GradleWrapperMain", "${this@subprojects.path}:runClient",
119+
"renderdoccmd", "capture", "--opt-api-validation", "--opt-api-validation-unmute", "--opt-hook-children",
120+
"--wait-for-exit", "--working-dir", ".", "$javaHome/bin/java", "-Xmx64m", "-Xms64m",
121+
/*"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005",*/
122+
"-Dorg.gradle.appname=gradlew", "-Dorg.gradle.java.home=$javaHome", "-classpath", gradleWrapper, "org.gradle.wrapper.GradleWrapperMain",
123+
"${this@subprojects.path}:runClient",
103124
)
104125
}
105-
106-
processResources {
107-
// Replaces placeholders in the mod info files
108-
filesMatching(targets) {
109-
expand(replacements)
110-
}
111-
112-
// Forces the task to always run
113-
outputs.upToDateWhen { false }
114-
}
115126
}
116127
}
117128

@@ -130,7 +141,7 @@ allprojects {
130141
mavenLocal() // Allow the use of local repositories
131142
maven("https://maven.shedaniel.me/") // Architectury
132143
maven("https://maven.terraformersmc.com/releases/")
133-
maven("https://babbaj.github.io/maven/") // Baritone
144+
maven("https://maven.2b2t.vc/releases") // Baritone
134145
maven("https://jitpack.io") // KDiscordIPC
135146
mavenCentral()
136147

@@ -143,22 +154,7 @@ allprojects {
143154
java {
144155
withSourcesJar()
145156

146-
sourceCompatibility = JavaVersion.VERSION_17
147-
targetCompatibility = JavaVersion.VERSION_17
157+
sourceCompatibility = JavaVersion.VERSION_21
158+
targetCompatibility = JavaVersion.VERSION_21
148159
}
149-
150-
tasks {
151-
compileKotlin {
152-
compilerOptions {
153-
jvmTarget = JvmTarget.JVM_17
154-
}
155-
}
156-
}
157-
}
158-
159-
private fun findExecutable(executable: String): String? {
160-
val isWindows = Os.isFamily(Os.FAMILY_WINDOWS)
161-
val cmd = if (isWindows) "where" else "which"
162-
163-
return ProcessBuilder(cmd, executable).start().inputStream.bufferedReader().readText().trim().takeIf { it.isNotBlank() }
164160
}

common/build.gradle.kts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -15,20 +15,22 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
val modId: String by project
1819
val modVersion: String by project
1920
val minecraftVersion: String by project
20-
val modId: String by project
2121
val fabricLoaderVersion: String by project
22-
val kotlinxCoroutinesVersion: String by project
22+
val pngEncoderVersion: String by project
2323
val discordIPCVersion: String by project
24+
val classGraphVersion: String by project
25+
val kotlinVersion: String by project
2426
val ktorVersion: String by project
2527
val mockitoKotlin: String by project
2628
val mockitoInline: String by project
2729
val mockkVersion: String by project
2830

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

31-
architectury { common("fabric", "forge") }
33+
architectury { common("fabric") }
3234

3335
loom {
3436
silentMojangMappingsLicense()
@@ -42,24 +44,24 @@ repositories {
4244
dependencies {
4345
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
4446
// Do NOT use other classes from fabric loader
45-
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
47+
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion") { isTransitive = false }
4648

4749
// Add dependencies on the required Kotlin modules.
48-
implementation("org.reflections:reflections:0.10.2")
50+
implementation("io.github.classgraph:classgraph:${classGraphVersion}")
4951
implementation("com.github.Edouard127:KDiscordIPC:$discordIPCVersion")
50-
implementation("com.pngencoder:pngencoder:0.15.0")
52+
implementation("com.pngencoder:pngencoder:$pngEncoderVersion")
53+
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
5154

5255
// Ktor
5356
implementation("io.ktor:ktor-client-core:$ktorVersion")
5457
implementation("io.ktor:ktor-client-cio:$ktorVersion")
5558
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
5659
implementation("io.ktor:ktor-serialization-gson:$ktorVersion")
5760

58-
// Add Kotlin
59-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
61+
implementation("io.github.classgraph:classgraph:4.8.179")
6062

6163
// Baritone
62-
modImplementation("baritone-api:baritone-unoptimized-fabric:1.10.2") { isTransitive = false }
64+
modImplementation("com.github.rfresh2:baritone-fabric:$minecraftVersion")
6365

6466
// Test implementations
6567
testImplementation(kotlin("test"))
@@ -77,10 +79,10 @@ tasks {
7779
useJUnitPlatform()
7880
jvmArgs("-XX:+EnableDynamicAgentLoading", "-Xshare:off")
7981
}
80-
}
8182

82-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
83-
kotlinOptions {
84-
jvmTarget = "17"
83+
compileKotlin {
84+
compilerOptions {
85+
freeCompilerArgs.set(listOf("-Xwhen-guards"))
86+
}
8587
}
8688
}

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

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

2020
import com.lambda.Lambda;
21+
import com.lambda.config.AbstractSetting;
2122
import com.lambda.module.Module;
2223
import com.lambda.module.ModuleRegistry;
2324
import com.lambda.util.DynamicException;
25+
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
26+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2427
import net.minecraft.client.MinecraftClient;
25-
import net.minecraft.util.Util;
2628
import net.minecraft.util.crash.CrashReport;
29+
import net.minecraft.util.crash.ReportType;
2730
import org.spongepowered.asm.mixin.Final;
2831
import org.spongepowered.asm.mixin.Mixin;
2932
import org.spongepowered.asm.mixin.Mutable;
3033
import org.spongepowered.asm.mixin.Shadow;
3134
import org.spongepowered.asm.mixin.injection.At;
3235
import org.spongepowered.asm.mixin.injection.Inject;
33-
import org.spongepowered.asm.mixin.injection.Redirect;
3436
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
35-
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
3637

37-
// Modify the crash report behavior for dynamic remapping, Easter egg and github issue link
38+
import java.util.ArrayList;
39+
import java.util.List;
40+
41+
// Modify the crash report behavior for dynamic remapping and GitHub issue link
3842
@Mixin(CrashReport.class)
3943
public class CrashReportMixin {
4044
@Mutable
@@ -47,33 +51,30 @@ void injectConstructor(String message, Throwable cause, CallbackInfo ci) {
4751
}
4852
}
4953

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");
54+
@WrapMethod(method = "asString(Lnet/minecraft/util/crash/ReportType;Ljava/util/List;)Ljava/lang/String;")
55+
String injectString(ReportType type, List<String> extraInfo, Operation<String> original) {
56+
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");
5359

5460
if (MinecraftClient.getInstance() != null) {
55-
stringBuilder.append("Enabled modules:\n");
61+
list.add("Enabled modules:");
5662

5763
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");
64+
.stream()
65+
.filter(Module::isEnabled)
66+
.forEach(module -> {
67+
list.add(String.format("\t%s", module.getName()));
6568

66-
instance.addStackTrace(stringBuilder);
67-
}
69+
module.getSettings()
70+
.stream()
71+
.filter(AbstractSetting::isModified)
72+
.forEach(setting -> list.add(String.format("\t\t%s -> %s", setting.getName(), setting.getValue())));
73+
});
74+
}
6875

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."};
76+
list.add("\n"+"-".repeat(43)+"\n");
7277

73-
try {
74-
cir.setReturnValue(strings[(int)(Util.getMeasuringTimeNano() % (long)strings.length)]);
75-
} catch (Throwable var2) {
76-
cir.setReturnValue("Witty comment unavailable :(");
77-
}
78+
return original.call(type, list);
7879
}
7980
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by

common/src/main/java/com/lambda/mixin/client/sound/SoundSystemMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Lambda
2+
* Copyright 2025 Lambda
33
*
44
* This program is free software: you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License as published by
@@ -98,9 +98,9 @@ public void clickSlotHead(int syncId, int slotId, int button, SlotActionType act
9898
* }
9999
* }</pre>
100100
*/
101-
@Redirect(method = "syncSelectedSlot", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerInventory;selectedSlot:I"))
101+
@Redirect(method = "syncSelectedSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerInventory;getSelectedSlot()I"))
102102
public int overrideSelectedSlotSync(PlayerInventory instance) {
103-
return EventFlow.post(new InventoryEvent.HotbarSlot.Update(instance.selectedSlot)).getSlot();
103+
return EventFlow.post(new InventoryEvent.HotbarSlot.Update(instance.getSelectedSlot())).getSlot();
104104
}
105105

106106
@Inject(method = "updateBlockBreakingProgress", at = @At("HEAD"), cancellable = true)

0 commit comments

Comments
 (0)