Skip to content

Commit 875c062

Browse files
committed
1.21.5
1 parent 42ae224 commit 875c062

File tree

436 files changed

+2174
-1854
lines changed

Some content is hidden

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

436 files changed

+2174
-1854
lines changed

build.gradle.kts

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.gradle.internal.jvm.*
1919
import net.fabricmc.loom.api.LoomGradleExtensionAPI
2020
import org.apache.tools.ant.taskdefs.condition.Os
21-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2221
import java.io.FileNotFoundException
2322
import java.util.*
2423

@@ -41,7 +40,7 @@ plugins {
4140
kotlin("jvm") version "2.1.10"
4241
id("org.jetbrains.dokka") version "2.0.0"
4342
id("architectury-plugin") version "3.4-SNAPSHOT"
44-
id("dev.architectury.loom") version "1.9-SNAPSHOT" apply false
43+
id("dev.architectury.loom") version "1.10-SNAPSHOT" apply false
4544
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
4645
id("maven-publish")
4746
}
@@ -85,33 +84,44 @@ subprojects {
8584

8685
if (path == ":common") return@subprojects
8786

87+
loom.mods {
88+
maybeCreate("main").apply {
89+
sourceSet(project.sourceSets.main.get())
90+
sourceSet(project(":common").sourceSets.main.get())
91+
}
92+
}
93+
8894
loom.runs {
8995
all {
9096
property("lambda.dev", "youtu.be/RYnFIRc0k6E")
97+
property("org.lwjgl.util.Debug", "true")
98+
99+
vmArgs("-XX:+HeapDumpOnOutOfMemoryError", "-XX:+CreateCoredumpOnCrash", "-XX:+UseOSErrorReporting", "-Xrs")
100+
programArgs("--username", "Steve", "--uuid", "8667ba71b85a4004af54457a9734eed7", "--accessToken", "****", "--userType", "msa")
91101
}
92102
}
93103

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

99117
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",
118+
"renderdoccmd", "capture", "--opt-api-validation", "--opt-api-validation-unmute", "--opt-hook-children",
119+
"--wait-for-exit", "--working-dir", ".", "$javaHome/bin/java", "-Xmx64m", "-Xms64m",
120+
/*"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005",*/
121+
"-Dorg.gradle.appname=gradlew", "-Dorg.gradle.java.home=$javaHome", "-classpath", gradleWrapper, "org.gradle.wrapper.GradleWrapperMain",
122+
"${this@subprojects.path}:runClient",
103123
)
104124
}
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-
}
115125
}
116126
}
117127

@@ -130,7 +140,7 @@ allprojects {
130140
mavenLocal() // Allow the use of local repositories
131141
maven("https://maven.shedaniel.me/") // Architectury
132142
maven("https://maven.terraformersmc.com/releases/")
133-
maven("https://babbaj.github.io/maven/") // Baritone
143+
maven("https://maven.2b2t.vc/releases") // Baritone
134144
maven("https://jitpack.io") // KDiscordIPC
135145
mavenCentral()
136146

@@ -146,19 +156,4 @@ allprojects {
146156
sourceCompatibility = JavaVersion.VERSION_21
147157
targetCompatibility = JavaVersion.VERSION_21
148158
}
149-
150-
tasks {
151-
compileKotlin {
152-
compilerOptions {
153-
jvmTarget = JvmTarget.JVM_21
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() }
164159
}

common/build.gradle.kts

Lines changed: 6 additions & 11 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
@@ -19,9 +19,7 @@ val modVersion: String by project
1919
val minecraftVersion: String by project
2020
val modId: String by project
2121
val fabricLoaderVersion: String by project
22-
val kotlinxCoroutinesVersion: String by project
2322
val discordIPCVersion: String by project
24-
val baritoneVersion: String by project
2523
val ktorVersion: String by project
2624
val mockitoKotlin: String by project
2725
val mockitoInline: String by project
@@ -56,11 +54,8 @@ dependencies {
5654
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
5755
implementation("io.ktor:ktor-serialization-gson:$ktorVersion")
5856

59-
// Add Kotlin
60-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
61-
6257
// Baritone
63-
modImplementation("baritone-api:baritone-unoptimized-fabric:1.10.2") { isTransitive = false }
58+
modImplementation("com.github.rfresh2:baritone-fabric:$minecraftVersion")
6459

6560
// Test implementations
6661
testImplementation(kotlin("test"))
@@ -78,10 +73,10 @@ tasks {
7873
useJUnitPlatform()
7974
jvmArgs("-XX:+EnableDynamicAgentLoading", "-Xshare:off")
8075
}
81-
}
8276

83-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
84-
kotlinOptions {
85-
jvmTarget = "17"
77+
compileKotlin {
78+
compilerOptions {
79+
freeCompilerArgs.set(listOf("-Xwhen-guards"))
80+
}
8681
}
8782
}

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 & 4 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
@@ -25,7 +25,6 @@
2525
import net.minecraft.entity.Entity;
2626
import net.minecraft.entity.player.PlayerEntity;
2727
import net.minecraft.entity.player.PlayerInventory;
28-
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
2928
import net.minecraft.screen.slot.SlotActionType;
3029
import net.minecraft.util.ActionResult;
3130
import net.minecraft.util.Hand;
@@ -99,9 +98,9 @@ public void clickSlotHead(int syncId, int slotId, int button, SlotActionType act
9998
* }
10099
* }</pre>
101100
*/
102-
@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"))
103102
public int overrideSelectedSlotSync(PlayerInventory instance) {
104-
return EventFlow.post(new InventoryEvent.HotbarSlot.Update(instance.selectedSlot)).getSlot();
103+
return EventFlow.post(new InventoryEvent.HotbarSlot.Update(instance.getSelectedSlot())).getSlot();
105104
}
106105

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

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

Lines changed: 17 additions & 19 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
@@ -26,13 +26,10 @@
2626
import com.lambda.interaction.request.rotation.RotationManager;
2727
import com.lambda.module.modules.player.PortalGui;
2828
import net.minecraft.client.MinecraftClient;
29-
import net.minecraft.client.gui.screen.DeathScreen;
3029
import net.minecraft.client.gui.screen.Screen;
31-
import net.minecraft.client.gui.screen.ingame.HandledScreen;
3230
import net.minecraft.client.input.Input;
3331
import net.minecraft.client.network.ClientPlayerEntity;
3432
import net.minecraft.entity.MovementType;
35-
import net.minecraft.entity.damage.DamageSource;
3633
import net.minecraft.util.Hand;
3734
import net.minecraft.util.math.Vec3d;
3835
import org.spongepowered.asm.mixin.Final;
@@ -49,8 +46,6 @@
4946
@Mixin(value = ClientPlayerEntity.class, priority = Integer.MAX_VALUE)
5047
public abstract class ClientPlayerEntityMixin extends EntityMixin {
5148

52-
@Shadow
53-
public Input input;
5449
@Shadow
5550
private boolean autoJumpEnabled;
5651

@@ -82,11 +77,11 @@ void onMove(MovementType movementType, Vec3d movement, CallbackInfo ci) {
8277
this.autoJump(currX - prevX, currZ - prevZ);
8378
}
8479

85-
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(ZF)V"))
86-
void processMovement(Input input, boolean slowDown, float slowDownFactor) {
87-
input.tick(slowDown, slowDownFactor);
88-
RotationManager.BaritoneProcessor.processPlayerMovement(input, slowDown, slowDownFactor);
89-
EventFlow.post(new MovementEvent.InputUpdate(input, slowDown, slowDownFactor));
80+
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick()V"))
81+
void processMovement(Input input) {
82+
input.tick();
83+
RotationManager.BaritoneProcessor.processPlayerMovement(input);
84+
EventFlow.post(new MovementEvent.InputUpdate(input));
9085
}
9186

9287
/**
@@ -139,12 +134,12 @@ void onTickPost(CallbackInfo ci) {
139134
EventFlow.post(new TickEvent.Player.Post());
140135
}
141136

142-
@Redirect(method = "tickNewAi", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getYaw()F"))
137+
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getYaw()F"))
143138
float fixHeldItemYaw(ClientPlayerEntity instance) {
144139
return Objects.requireNonNullElse(RotationManager.getHandYaw(), instance.getYaw());
145140
}
146141

147-
@Redirect(method = "tickNewAi", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getPitch()F"))
142+
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getPitch()F"))
148143
float fixHeldItemPitch(ClientPlayerEntity instance) {
149144
return Objects.requireNonNullElse(RotationManager.getHandPitch(), instance.getPitch());
150145
}
@@ -154,24 +149,27 @@ void onSwingHandPre(Hand hand, CallbackInfo ci) {
154149
if (EventFlow.post(new PlayerEvent.SwingHand(hand)).isCanceled()) ci.cancel();
155150
}
156151

157-
@Inject(method = "damage", at = @At("HEAD"), cancellable = true)
158-
public void damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
159-
if (EventFlow.post(new PlayerEvent.Damage(source, amount)).isCanceled()) cir.setReturnValue(false);
152+
@Inject(method = "updateHealth", at = @At("HEAD"))
153+
public void damage(float health, CallbackInfo ci) {
154+
EventFlow.post(new PlayerEvent.Damage(health));
160155
}
161156

162157
/**
163158
* Prevents the game from closing Guis when the player is in a nether portal
164159
* <pre>{@code
165-
* if (this.client.currentScreen != null && !this.client.currentScreen.shouldPause() && !(this.client.currentScreen instanceof DeathScreen)) {
160+
* if (this.client.currentScreen != null
161+
* && !this.client.currentScreen.shouldPause()
162+
* && !(this.client.currentScreen instanceof DeathScreen)
163+
* && !(this.client.currentScreen instanceof CreditsScreen)) {
166164
* if (this.client.currentScreen instanceof HandledScreen) {
167165
* this.closeHandledScreen();
168166
* }
169167
*
170-
* this.client.setScreen((Screen)null);
168+
* this.client.setScreen(null);
171169
* }
172170
* }</pre>
173171
*/
174-
@Redirect(method = "updateNausea", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;"))
172+
@Redirect(method = "tickNausea", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;"))
175173
Screen keepScreensInPortal(MinecraftClient instance) {
176174
if (PortalGui.INSTANCE.isEnabled()) return null;
177175
else return client.currentScreen;

0 commit comments

Comments
 (0)