Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/main/java/com/lambda/mixin/CrashReportMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ void injectConstructor(String message, Throwable cause, CallbackInfo ci) {
@WrapMethod(method = "asString(Lnet/minecraft/util/crash/ReportType;Ljava/util/List;)Ljava/lang/String;")
String injectString(ReportType type, List<String> extraInfo, Operation<String> original) {
var list = new ArrayList<>(extraInfo);

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");
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");

if (MinecraftClient.getInstance() != null) {
list.add("Enabled modules:");
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/com/lambda/mixin/render/ScreenMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2025 Lambda
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.lambda.mixin.render;

import com.lambda.gui.components.QuickSearch;
import net.minecraft.client.gui.screen.Screen;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(Screen.class)
public class ScreenMixin {

@Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true)
private void onKeyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
if (keyCode == GLFW.GLFW_KEY_ESCAPE && QuickSearch.INSTANCE.isOpen()) {
QuickSearch.INSTANCE.close();
cir.setReturnValue(true);
}
}
}
1 change: 1 addition & 0 deletions src/main/kotlin/com/lambda/Lambda.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ object Lambda : ClientModInitializer {
const val MOD_ID = "lambda"
const val SYMBOL = "λ"
const val APP_ID = "1221289599427416127"
const val REPO_URL = "https://github.com/lambda-client/lambda"
val VERSION: String = FabricLoader.getInstance()
.getModContainer("lambda").orElseThrow()
.metadata.version.friendlyString
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/com/lambda/config/AbstractSetting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ abstract class AbstractSetting<T : Any>(
groups.add(path.toList())
}

fun reset() {
if (value == defaultValue) {
fun reset(silent: Boolean = false) {
if (!silent && value == defaultValue) {
ConfigCommand.info(notChangedMessage())
return
}
ConfigCommand.info(resetMessage(value, defaultValue))
if (!silent) ConfigCommand.info(resetMessage(value, defaultValue))
value = defaultValue
}

Expand Down
26 changes: 20 additions & 6 deletions src/main/kotlin/com/lambda/gui/DearImGui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,26 @@ import com.lambda.module.modules.client.GuiSettings
import com.lambda.util.path
import com.mojang.blaze3d.opengl.GlStateManager
import com.mojang.blaze3d.systems.RenderSystem
import imgui.ImFontConfig
import imgui.ImFontGlyphRangesBuilder
import imgui.ImGui
import imgui.ImGuiIO
import imgui.flag.ImGuiConfigFlags
import imgui.gl3.ImGuiImplGl3
import imgui.glfw.ImGuiImplGlfw
import net.minecraft.client.gl.GlBackend
import net.minecraft.client.texture.GlTexture
import org.lwjgl.opengl.GL11.glViewport
import org.lwjgl.opengl.GL30.GL_FRAMEBUFFER
import kotlin.math.abs

object DearImGui : Loadable {
val implGlfw = ImGuiImplGlfw()
val implGl3 = ImGuiImplGl3()

const val EXTERNAL_LINK = '↗'
const val BREADCRUMB_SEPARATOR = '»'
const val BASE_FONT_SCALE = 13f

val io: ImGuiIO get() = ImGui.getIO()
const val DEFAULT_FLAGS = ImGuiConfigFlags.NavEnableKeyboard or // Enable Keyboard Controls
ImGuiConfigFlags.NavEnableSetMousePos or // Move the cursor using the keyboard
Expand All @@ -52,11 +57,20 @@ object DearImGui : Loadable {
private var targetScale = 0f

private fun updateScale(scale: Float) {
io.fonts.clear()
val baseFontSize = 13f
io.fonts.addFontFromFileTTF("fonts/FiraSans-Regular.ttf".path, baseFontSize * scale)
io.fonts.build()

val glyphRanges = ImFontGlyphRangesBuilder().apply {
addRanges(io.fonts.glyphRangesDefault)
addRanges(io.fonts.glyphRangesGreek)
addChar(EXTERNAL_LINK)
addChar(BREADCRUMB_SEPARATOR)
}.buildRanges()
val fontConfig = ImFontConfig()
val size = BASE_FONT_SCALE * scale
with(io.fonts) {
clear()
addFontFromFileTTF("fonts/FiraSans-Regular.ttf".path, size, fontConfig, glyphRanges)
addFontFromFileTTF("fonts/MinecraftDefault-Regular.ttf".path, size, fontConfig, glyphRanges)
build()
}
implGl3.createFontsTexture()
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/com/lambda/gui/LambdaScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import net.minecraft.client.gui.DrawContext
import net.minecraft.client.gui.screen.Screen
import net.minecraft.text.Text


object LambdaScreen : Screen(Text.of("")) {
object LambdaScreen : Screen(Text.of("Lambda")) {
override fun shouldPause() = false
override fun removed() = ClickGui.disable()
override fun render(context: DrawContext?, mouseX: Int, mouseY: Int, deltaTicks: Float) {}
Expand Down
Loading