Skip to content

Commit 8bb1272

Browse files
committed
Merge branch '1.21.5' into improvement/scaffold
2 parents 57409c9 + 455c94d commit 8bb1272

38 files changed

+1093
-135
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ void injectConstructor(String message, Throwable cause, CallbackInfo ci) {
5454
@WrapMethod(method = "asString(Lnet/minecraft/util/crash/ReportType;Ljava/util/List;)Ljava/lang/String;")
5555
String injectString(ReportType type, List<String> extraInfo, Operation<String> original) {
5656
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");
57+
list.add("If this issue is related to Lambda, check if other users have experienced this too, or create a new issue at " + Lambda.REPO_URL + "/issues.\n\n");
5958

6059
if (MinecraftClient.getInstance() != null) {
6160
list.add("Enabled modules:");

src/main/java/com/lambda/mixin/items/BarrierBlockMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import net.minecraft.block.BarrierBlock;
2222
import net.minecraft.block.BlockRenderType;
2323
import net.minecraft.block.BlockState;
24+
import net.minecraft.block.Blocks;
2425
import org.spongepowered.asm.mixin.Mixin;
2526
import org.spongepowered.asm.mixin.injection.At;
2627
import org.spongepowered.asm.mixin.injection.Inject;
@@ -33,10 +34,9 @@ public class BarrierBlockMixin {
3334
*/
3435
@Inject(method = "getRenderType", at = @At("RETURN"), cancellable = true)
3536
private void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
36-
// FixMe: This mixins fucks up the loading process by calling the configurations too early and doesn't load the settings
37-
/*if (BlockESP.INSTANCE.isEnabled()
37+
if (BlockESP.INSTANCE.isEnabled()
3838
&& BlockESP.getBarrier()
3939
&& state.getBlock() == Blocks.BARRIER
40-
) cir.setReturnValue(BlockRenderType.MODEL);*/
40+
) cir.setReturnValue(BlockRenderType.MODEL);
4141
}
4242
}

src/main/java/com/lambda/mixin/network/ClientConnectionMixin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.spongepowered.asm.mixin.Final;
3535
import org.spongepowered.asm.mixin.Mixin;
3636
import org.spongepowered.asm.mixin.Shadow;
37+
import org.spongepowered.asm.mixin.Unique;
3738
import org.spongepowered.asm.mixin.injection.At;
3839
import org.spongepowered.asm.mixin.injection.Inject;
3940
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -62,7 +63,7 @@ private void sendingPacketPost(Packet<?> packet, final CallbackInfo callbackInfo
6263
EventFlow.post(new PacketEvent.Send.Post((Packet<? extends ServerPlayPacketListener>) packet));
6364
}
6465

65-
@SuppressWarnings("all")
66+
@SuppressWarnings("unchecked")
6667
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/packet/Packet;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;handlePacket(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;)V", shift = At.Shift.BEFORE), cancellable = true, require = 1)
6768
private void receivingPacket(
6869
ChannelHandlerContext channelHandlerContext,

src/main/java/com/lambda/mixin/render/LivingEntityRendererMixin.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717

1818
package com.lambda.mixin.render;
1919

20+
import com.lambda.Lambda;
2021
import com.lambda.interaction.request.rotating.RotationManager;
21-
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
22+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
23+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2224
import net.minecraft.client.render.entity.LivingEntityRenderer;
25+
import net.minecraft.entity.LivingEntity;
2326
import org.spongepowered.asm.mixin.Mixin;
2427
import org.spongepowered.asm.mixin.injection.At;
2528

@@ -44,8 +47,10 @@ public class LivingEntityRendererMixin {
4447
* }
4548
* }</pre>
4649
*/
47-
@ModifyExpressionValue(method = "updateRenderState(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getLerpedPitch(F)F"))
48-
private float injectRotationPitch(float original) {
49-
return Objects.requireNonNullElse(RotationManager.getHeadPitch(), original);
50+
@WrapOperation(method = "updateRenderState(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;F)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getLerpedPitch(F)F"))
51+
private float wrapGetLerpedPitch(LivingEntity instance, float v, Operation<Float> original) {
52+
return (instance == Lambda.getMc().player)
53+
? Objects.requireNonNullElse(RotationManager.getHeadPitch(), original.call(instance, v))
54+
: original.call(instance, v);
5055
}
5156
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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.render;
19+
20+
import com.lambda.gui.components.QuickSearch;
21+
import net.minecraft.client.gui.screen.Screen;
22+
import org.lwjgl.glfw.GLFW;
23+
import org.spongepowered.asm.mixin.Mixin;
24+
import org.spongepowered.asm.mixin.injection.At;
25+
import org.spongepowered.asm.mixin.injection.Inject;
26+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
27+
28+
@Mixin(Screen.class)
29+
public class ScreenMixin {
30+
31+
@Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true)
32+
private void onKeyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
33+
if (keyCode == GLFW.GLFW_KEY_ESCAPE && QuickSearch.INSTANCE.isOpen()) {
34+
QuickSearch.INSTANCE.close();
35+
cir.setReturnValue(true);
36+
}
37+
}
38+
}

src/main/kotlin/com/lambda/Lambda.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ object Lambda : ClientModInitializer {
5151
const val MOD_ID = "lambda"
5252
const val SYMBOL = "λ"
5353
const val APP_ID = "1221289599427416127"
54+
const val REPO_URL = "https://github.com/lambda-client/lambda"
5455
val VERSION: String = FabricLoader.getInstance()
5556
.getModContainer("lambda").orElseThrow()
5657
.metadata.version.friendlyString

src/main/kotlin/com/lambda/config/AbstractSetting.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ abstract class AbstractSetting<T : Any>(
158158
groups.add(path.toList())
159159
}
160160

161-
fun reset() {
162-
if (value == defaultValue) {
161+
fun reset(silent: Boolean = false) {
162+
if (!silent && value == defaultValue) {
163163
ConfigCommand.info(notChangedMessage())
164164
return
165165
}
166-
ConfigCommand.info(resetMessage(value, defaultValue))
166+
if (!silent) ConfigCommand.info(resetMessage(value, defaultValue))
167167
value = defaultValue
168168
}
169169

src/main/kotlin/com/lambda/config/configurations/ConfigLoader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ object ConfigLoader: Loadable {
2525
Configuration.configurations.forEach {
2626
it.tryLoad()
2727
}
28-
return "Loaded ${Configuration.configurations.size} configurations"
28+
return "Loading ${Configuration.configurations.size} configurations"
2929
}
3030
}

src/main/kotlin/com/lambda/gui/DearImGui.kt

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,26 @@ import com.lambda.module.modules.client.GuiSettings
2626
import com.lambda.util.path
2727
import com.mojang.blaze3d.opengl.GlStateManager
2828
import com.mojang.blaze3d.systems.RenderSystem
29+
import imgui.ImFontConfig
30+
import imgui.ImFontGlyphRangesBuilder
2931
import imgui.ImGui
3032
import imgui.ImGuiIO
3133
import imgui.flag.ImGuiConfigFlags
3234
import imgui.gl3.ImGuiImplGl3
3335
import imgui.glfw.ImGuiImplGlfw
3436
import net.minecraft.client.gl.GlBackend
3537
import net.minecraft.client.texture.GlTexture
36-
import org.lwjgl.opengl.GL11.glViewport
3738
import org.lwjgl.opengl.GL30.GL_FRAMEBUFFER
3839
import kotlin.math.abs
3940

4041
object DearImGui : Loadable {
4142
val implGlfw = ImGuiImplGlfw()
4243
val implGl3 = ImGuiImplGl3()
4344

45+
const val EXTERNAL_LINK = ''
46+
const val BREADCRUMB_SEPARATOR = '»'
47+
const val BASE_FONT_SCALE = 13f
48+
4449
val io: ImGuiIO get() = ImGui.getIO()
4550
const val DEFAULT_FLAGS = ImGuiConfigFlags.NavEnableKeyboard or // Enable Keyboard Controls
4651
ImGuiConfigFlags.NavEnableSetMousePos or // Move the cursor using the keyboard
@@ -52,11 +57,20 @@ object DearImGui : Loadable {
5257
private var targetScale = 0f
5358

5459
private fun updateScale(scale: Float) {
55-
io.fonts.clear()
56-
val baseFontSize = 13f
57-
io.fonts.addFontFromFileTTF("fonts/FiraSans-Regular.ttf".path, baseFontSize * scale)
58-
io.fonts.build()
59-
60+
val glyphRanges = ImFontGlyphRangesBuilder().apply {
61+
addRanges(io.fonts.glyphRangesDefault)
62+
addRanges(io.fonts.glyphRangesGreek)
63+
addChar(EXTERNAL_LINK)
64+
addChar(BREADCRUMB_SEPARATOR)
65+
}.buildRanges()
66+
val fontConfig = ImFontConfig()
67+
val size = BASE_FONT_SCALE * scale
68+
with(io.fonts) {
69+
clear()
70+
addFontFromFileTTF("fonts/FiraSans-Regular.ttf".path, size, fontConfig, glyphRanges)
71+
addFontFromFileTTF("fonts/MinecraftDefault-Regular.ttf".path, size, fontConfig, glyphRanges)
72+
build()
73+
}
6074
implGl3.createFontsTexture()
6175
}
6276

src/main/kotlin/com/lambda/gui/LambdaScreen.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import net.minecraft.client.gui.DrawContext
2222
import net.minecraft.client.gui.screen.Screen
2323
import net.minecraft.text.Text
2424

25-
26-
object LambdaScreen : Screen(Text.of("")) {
25+
object LambdaScreen : Screen(Text.of("Lambda")) {
2726
override fun shouldPause() = false
2827
override fun removed() = ClickGui.disable()
2928
override fun render(context: DrawContext?, mouseX: Int, mouseY: Int, deltaTicks: Float) {}

0 commit comments

Comments
 (0)