Skip to content

Commit 1c71a57

Browse files
committed
hud
1 parent 1d3f53c commit 1c71a57

40 files changed

+418
-322
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import com.lambda.event.EventFlow;
2121
import com.lambda.event.events.RenderEvent;
22+
import com.lambda.gui.DearImGui;
2223
import com.lambda.gui.LambdaScreen;
2324
import com.lambda.module.modules.client.ClickGui;
2425
import net.minecraft.client.render.GameRenderer;
@@ -36,10 +37,4 @@ private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) {
3637
info.cancel();
3738
}
3839
}
39-
40-
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER))
41-
void renderGui(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
42-
if (ClickGui.INSTANCE.isEnabled())
43-
LambdaScreen.INSTANCE.render();
44-
}
4540
}
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.DearImGui;
21+
import net.minecraft.client.gui.DrawContext;
22+
import net.minecraft.client.gui.hud.InGameHud;
23+
import net.minecraft.client.render.RenderTickCounter;
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.CallbackInfo;
28+
29+
@Mixin(InGameHud.class)
30+
public class InGameHudMixin {
31+
/**
32+
* Begins our 2d render after the game has rendered all 2d elements
33+
*/
34+
@Inject(method = "render", at = @At("TAIL"))
35+
private void onRender(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
36+
DearImGui.INSTANCE.render();
37+
}
38+
}

src/main/kotlin/com/lambda/config/settings/CharSetting.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ class CharSetting(
4343
description,
4444
visibility
4545
) {
46-
override fun ImGuiBuilder.buildLayout() {
47-
// ToDo
48-
}
46+
override fun invoke(p1: ImGuiBuilder) {}
4947

5048
override fun CommandBuilder.buildCommand(registry: CommandRegistryAccess) {
5149
required(word(name)) { parameter ->

src/main/kotlin/com/lambda/config/settings/FunctionSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ open class FunctionSetting<T>(
3434
description,
3535
visibility
3636
) {
37-
override fun ImGuiBuilder.buildLayout() {
37+
override fun invoke(p1: ImGuiBuilder) = with(p1) {
3838
button(name) { value() }
3939
lambdaTooltip(description)
4040
}

src/main/kotlin/com/lambda/config/settings/NumericSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ abstract class NumericSetting<T>(
5757
*/
5858
protected abstract fun ImGuiBuilder.buildSlider()
5959

60-
override fun ImGuiBuilder.buildLayout() {
60+
override fun invoke(p1: ImGuiBuilder) = with(p1) {
6161
val showReset = isModified
6262
val resetButtonText = "R"
6363
val valueString = this@NumericSetting.toString()

src/main/kotlin/com/lambda/config/settings/StringSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class StringSetting(
4444
description,
4545
visibility
4646
) {
47-
override fun ImGuiBuilder.buildLayout() {
47+
override fun invoke(p1: ImGuiBuilder) = with(p1) {
4848
if (multiline) {
4949
inputTextMultiline(name, ::value, flags = flags)
5050
} else {

src/main/kotlin/com/lambda/config/settings/collections/ListSetting.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class ListSetting<T : Any>(
4444
private val strListType =
4545
TypeToken.getParameterized(MutableList::class.java, String::class.java).type
4646

47-
override fun ImGuiBuilder.buildLayout() {
47+
override fun invoke(p1: ImGuiBuilder) = with(p1) {
4848
combo("##$name", "$name: ${value.size} item(s)") {
4949
immutableList
5050
.forEach {
@@ -53,8 +53,7 @@ class ListSetting<T : Any>(
5353
selectable(
5454
it.toString(), isSelected,
5555
flags = DontClosePopups
56-
)
57-
{ if (isSelected) value.remove(it) else value.add(it) }
56+
) { if (isSelected) value.remove(it) else value.add(it) }
5857
}
5958
}
6059
}

src/main/kotlin/com/lambda/config/settings/collections/MapSetting.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,5 @@ class MapSetting<K, V>(
3636
description,
3737
visibility
3838
) {
39-
override fun ImGuiBuilder.buildLayout() {
40-
// ToDo
41-
}
39+
override fun invoke(p1: ImGuiBuilder) = with(p1) {}
4240
}

src/main/kotlin/com/lambda/config/settings/collections/SetSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SetSetting<T : Any>(
4444
private val strSetType =
4545
TypeToken.getParameterized(Set::class.java, String::class.java).type
4646

47-
override fun ImGuiBuilder.buildLayout() {
47+
override fun invoke(p1: ImGuiBuilder) = with(p1) {
4848
combo("##$name", "$name: ${value.size} item(s)") {
4949
immutableSet
5050
.forEach {

src/main/kotlin/com/lambda/config/settings/comparable/BooleanSetting.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class BooleanSetting(
4141
description,
4242
visibility
4343
) {
44-
override fun ImGuiBuilder.buildLayout() {
44+
override fun invoke(p1: ImGuiBuilder) = with(p1) {
4545
checkbox(name, ::value)
4646
lambdaTooltip(description)
4747
}

0 commit comments

Comments
 (0)