Skip to content

Commit 1fddb0f

Browse files
authored
Rewrite: A complete GUI Rewrite implemented via Compose (#366)
1 parent 9a269b0 commit 1fddb0f

144 files changed

Lines changed: 10949 additions & 5546 deletions

File tree

Some content is hidden

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

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Find our backup matrix space at [\#lambda-client:matrix.org](https://app.element
4040

4141
### Sophisticated User Experience
4242
* **Fine-Grained Control:** Access over **1000+ settings**, allowing you to tune every aspect of the client to your exact needs.
43-
* **Advanced GUI:** The **Dear ImGui** interface is designed for clarity and depth, featuring quick search, context menus, and easy keybind editing.
43+
* **Advanced GUI:** The **Jetpack Compose** interface is designed for clarity and depth, featuring quick search, context menus, and easy keybind editing.
4444
* **Automation Profiles:** Use linkable configs to apply complex configurations across multiple modules instantly.
4545

4646
### Stability & Safety

‎build.gradle.kts‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ val kotlinVersion: String by project
3232
val ktorVersion: String by project
3333
val jacksonVersion: String by project
3434
val mockkVersion: String by project
35-
val spairVersion: String by project
3635
val lwjglVersion: String by project
3736
val sodiumVersion: String by project
3837
val litematicaVersion: String by project
3938
val maLiLibVersion: String by project
39+
val composeVersion: String by project
40+
val skikoVersion: String by project
41+
42+
val skikoPlatforms = listOf("windows-x64", "windows-arm64", "linux-x64", "linux-arm64", "macos-x64", "macos-arm64")
4043

4144
val libs = file("libs")
4245
val targets = listOf("fabric.mod.json")
@@ -46,6 +49,7 @@ val replacements = file("gradle.properties").inputStream().use { stream ->
4649

4750
plugins {
4851
kotlin("jvm") version "2.3.21"
52+
kotlin("plugin.compose") version "2.3.21"
4953
id("org.jetbrains.dokka") version "2.1.0"
5054
id("fabric-loom") version "1.17-SNAPSHOT"
5155
id("com.gradleup.shadow") version "9.3.0"
@@ -72,6 +76,9 @@ configurations.all {
7276
if (requested.group == "org.lwjgl") {
7377
useVersion(lwjglVersion)
7478
}
79+
if (requested.group == "org.jetbrains.skiko") {
80+
useVersion(skikoVersion)
81+
}
7582
}
7683
}
7784

@@ -81,6 +88,7 @@ repositories {
8188
maven("https://maven.2b2t.vc/releases") // Baritone
8289
maven("https://jitpack.io") // KDiscordIPC
8390
maven("https://api.modrinth.com/maven")
91+
google()
8492
mavenCentral()
8593

8694
// Allow the use of local libraries
@@ -169,11 +177,19 @@ dependencies {
169177
includeLib("com.github.beanbag44:KDiscordIPC:$discordIPCVersion")
170178
includeLib("com.pngencoder:pngencoder:$pngEncoderVersion")
171179

172-
includeLib("com.lambda:lambda-imgui-java-binding:$spairVersion")
173-
includeLib("com.lambda:lambda-imgui-java-lwjgl3:$spairVersion")
174-
includeLib("com.lambda:lambda-imgui-java-natives-windows:$spairVersion")
175-
includeLib("com.lambda:lambda-imgui-java-natives-linux:$spairVersion")
176-
includeLib("com.lambda:lambda-imgui-java-natives-macos:$spairVersion")
180+
181+
listOf("runtime:runtime", "ui:ui", "foundation:foundation").forEach { module ->
182+
shadowLib("org.jetbrains.compose.$module-desktop:$composeVersion") {
183+
exclude(group = "org.jetbrains.kotlin")
184+
exclude(group = "org.jetbrains.kotlinx")
185+
}
186+
}
187+
skikoPlatforms.forEach { platform ->
188+
shadowLib("org.jetbrains.skiko:skiko-awt-runtime-$platform:$skikoVersion") {
189+
exclude(group = "org.jetbrains.kotlin")
190+
exclude(group = "org.jetbrains.kotlinx")
191+
}
192+
}
177193

178194
// Ktor
179195
includeLib("io.ktor:ktor-client-core:$ktorVersion")

‎gradle.properties‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ classGraphVersion=4.8.184
3737
ktorVersion=3.3.3
3838
jacksonVersion=3.1.4
3939
mockkVersion=1.14.7
40-
spairVersion=1.90.0
40+
composeVersion=1.12.2
41+
# Must be the skiko version the Compose version above depends on
42+
skikoVersion=0.150.2
4143

4244
# Fabric https://fabricmc.net/develop/
4345
fabricLoaderVersion=0.19.5

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.*;
22-
import com.lambda.gui.DearImGui;
23-
import com.lambda.gui.components.ClickGuiLayout;
22+
import com.lambda.gui.GuiConfig;
2423
import com.lambda.interaction.handler.handlers.TimerHandler;
2524
import com.lambda.module.modules.movement.BetterFirework;
2625
import com.lambda.module.modules.player.Interact;
@@ -65,11 +64,6 @@ public class MinecraftClientMixin {
6564
@Shadow
6665
public int itemUseCooldown;
6766

68-
@Inject(method = "close", at = @At("HEAD"))
69-
void closeImGui(CallbackInfo ci) {
70-
DearImGui.INSTANCE.destroy();
71-
}
72-
7367
@WrapMethod(method = "render")
7468
void onLoopTick(boolean tick, Operation<Void> original) {
7569
com.lambda.graphics.RenderMain.preRender();
@@ -201,7 +195,7 @@ float getTargetMillisPerTick(float millis, Operation<Float> original) {
201195

202196
@Inject(method = "updateWindowTitle", at = @At("HEAD"), cancellable = true)
203197
void updateWindowTitle(CallbackInfo ci) {
204-
if (!ClickGuiLayout.getSetLambdaWindowTitle()) return;
198+
if (!GuiConfig.getSetLambdaWindowTitle()) return;
205199
WindowUtils.setLambdaTitle();
206200
ci.cancel();
207201
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
package com.lambda.mixin.entity;
1919

20+
import com.lambda.config.ClientConfig;
2021
import com.lambda.event.EventFlow;
2122
import com.lambda.event.events.InventoryEvent;
2223
import com.lambda.event.events.PlayerEvent;
2324
import com.lambda.interaction.handler.handlers.BaritoneHandler;
2425
import com.lambda.interaction.manager.managers.inventory.InventoryManager;
2526
import com.lambda.interaction.manager.managers.rotating.RotationManager;
26-
import com.lambda.module.modules.client.Client;
2727
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
2828
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
2929
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
@@ -120,7 +120,7 @@ public void clickSlotTail(int syncId, int slotId, int button, SlotActionType act
120120

121121
@ModifyExpressionValue(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/ScreenHandler;getRevision()I"))
122122
private int modifyClickSlotRevision(int originalRevision) {
123-
return Client.INSTANCE.getAvoidInventoryDesync() ? -1 : originalRevision;
123+
return ClientConfig.INSTANCE.getAvoidInventoryDesync() ? -1 : originalRevision;
124124
}
125125

126126
/**

‎src/main/java/com/lambda/mixin/input/KeyboardMixin.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@
2727
import net.minecraft.client.input.KeyInput;
2828
import net.minecraft.client.option.KeyBinding;
2929
import net.minecraft.client.util.InputUtil;
30+
import org.lwjgl.glfw.GLFW;
3031
import org.spongepowered.asm.mixin.Mixin;
3132

3233
@Mixin(Keyboard.class)
3334
public class KeyboardMixin {
3435
@WrapMethod(method = "onKey")
3536
private void onKey(long window, int action, KeyInput input, Operation<Void> original) {
36-
EventFlow.post(new ButtonEvent.Keyboard.Press(input.key(), input.scancode(), action, input.modifiers()));
37+
if (EventFlow.post(new ButtonEvent.Keyboard.Press(input.key(), input.scancode(), action, input.modifiers())).isCanceled()) return;
3738
original.call(window, action, input);
3839
int key = input.key();
39-
if (!InventoryMove.getShouldMove() || !InventoryMove.isKeyMovementRelated(key)) return;
40+
if (!InventoryMove.isKeyMovementRelated(key)) return;
41+
if (action != GLFW.GLFW_RELEASE && !InventoryMove.getShouldMove()) return;
4042
InputUtil.Key fromCode = InputUtil.fromKeyCode(input);
4143
KeyBinding.setKeyPressed(fromCode, action != 0);
4244
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2026 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 androidx.compose.ui.Actuals_skikoKt;
21+
import com.lambda.gui.core.RenderThread;
22+
import kotlin.Unit;
23+
import kotlin.jvm.functions.Function0;
24+
import org.spongepowered.asm.mixin.Mixin;
25+
import org.spongepowered.asm.mixin.injection.At;
26+
import org.spongepowered.asm.mixin.injection.Inject;
27+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
28+
29+
@Mixin(value = Actuals_skikoKt.class, remap = false)
30+
public class ComposeDelayMixin {
31+
@Inject(method = "postDelayed", at = @At("HEAD"), cancellable = true, require = 1)
32+
private static void delayOnRenderThread(long delayMillis, Function0<Unit> block, CallbackInfoReturnable<Object> cir) {
33+
cir.setReturnValue(RenderThread.after(delayMillis, block));
34+
}
35+
}

‎src/main/java/com/lambda/mixin/render/GameRendererMixin.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import com.lambda.event.events.RenderEvent;
2323
import com.lambda.graphics.RenderMain;
2424
import com.lambda.graphics.outline.OutlineCapturingQueue;
25-
import com.lambda.gui.DearImGui;
25+
import com.lambda.gui.LambdaGui;
2626
import com.lambda.module.modules.render.BlockOutline;
2727
import com.lambda.module.modules.render.Bobbing;
2828
import com.lambda.module.modules.render.NoRender;
@@ -91,7 +91,7 @@ private float modifyGetFov(float original) {
9191

9292
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/render/GuiRenderer;render(Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V", shift = At.Shift.AFTER))
9393
private void onGuiRenderComplete(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
94-
DearImGui.INSTANCE.render();
94+
LambdaGui.INSTANCE.render();
9595
}
9696

9797
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;applyCursorTo(Lnet/minecraft/client/util/Window;)V"))
@@ -102,7 +102,7 @@ private void applyCursorOverride(DrawContext context, Window window, Operation<V
102102
Cursor cursor = provider.getCursorOverride(mouseX, mouseY);
103103

104104
if (cursor != null) {
105-
cursor.applyTo(window);
105+
window.setCursor(cursor);
106106
return;
107107
}
108108
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2026 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.render.ItemAtlas;
21+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
22+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
23+
import net.minecraft.client.MinecraftClient;
24+
import net.minecraft.client.gl.Framebuffer;
25+
import net.minecraft.client.gui.render.GuiRenderer;
26+
import net.minecraft.client.util.Window;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.injection.At;
29+
30+
@Mixin(GuiRenderer.class)
31+
public class GuiRendererMixin {
32+
@WrapOperation(method = "renderPreparedDraws", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getFramebuffer()Lnet/minecraft/client/gl/Framebuffer;"), require = 1)
33+
private Framebuffer drawIntoItemAtlas(MinecraftClient client, Operation<Framebuffer> original) {
34+
Framebuffer atlas = ItemAtlas.getTarget();
35+
return atlas != null ? atlas : original.call(client);
36+
}
37+
38+
@WrapOperation(method = "renderPreparedDraws", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getFramebufferWidth()I"), require = 1)
39+
private int itemAtlasWidth(Window window, Operation<Integer> original) {
40+
Framebuffer atlas = ItemAtlas.getTarget();
41+
return atlas != null ? atlas.textureWidth : original.call(window);
42+
}
43+
44+
@WrapOperation(method = "renderPreparedDraws", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getFramebufferHeight()I"), require = 1)
45+
private int itemAtlasHeight(Window window, Operation<Integer> original) {
46+
Framebuffer atlas = ItemAtlas.getTarget();
47+
return atlas != null ? atlas.textureHeight : original.call(window);
48+
}
49+
50+
@WrapOperation(method = {"renderPreparedDraws", "getWindowScaleFactor"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/Window;getScaleFactor()I"), require = 1)
51+
private int itemAtlasScale(Window window, Operation<Integer> original) {
52+
return ItemAtlas.getTarget() != null ? ItemAtlas.getScale() : original.call(window);
53+
}
54+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2026 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.GuiScreen;
21+
import com.lambda.gui.LambdaGui;
22+
import com.lambda.interaction.handler.handlers.NotificationHandler;
23+
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
24+
import net.minecraft.client.MinecraftClient;
25+
import net.minecraft.client.option.InactivityFpsLimiter;
26+
import org.spongepowered.asm.mixin.Final;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.Shadow;
29+
import org.spongepowered.asm.mixin.injection.At;
30+
31+
@Mixin(InactivityFpsLimiter.class)
32+
public class InactivityFpsLimiterMixin {
33+
@Shadow
34+
@Final
35+
private MinecraftClient client;
36+
37+
@ModifyReturnValue(method = "getLimitReason", at = @At("RETURN"))
38+
private InactivityFpsLimiter.LimitReason liftMenuLimit(InactivityFpsLimiter.LimitReason reason) {
39+
boolean shown = client.currentScreen == GuiScreen.INSTANCE
40+
|| LambdaGui.INSTANCE.getLeaving()
41+
|| !NotificationHandler.INSTANCE.getNotifications().isEmpty();
42+
if (reason == InactivityFpsLimiter.LimitReason.OUT_OF_LEVEL_MENU && shown) {
43+
return InactivityFpsLimiter.LimitReason.NONE;
44+
}
45+
return reason;
46+
}
47+
}

0 commit comments

Comments
 (0)