Skip to content

Commit 77fecd7

Browse files
committed
use hud window
1 parent 33ec725 commit 77fecd7

File tree

3 files changed

+46
-49
lines changed

3 files changed

+46
-49
lines changed

src/main/kotlin/com/lambda/interaction/request/DebugLogger.kt

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -76,60 +76,58 @@ class DebugLogger(
7676
fun ImGuiBuilder.buildLayout() {
7777
ImGui.setNextWindowSizeConstraints(300f, 400f, windowViewport.workSizeX, windowViewport.workSizeY)
7878
ImGui.setNextWindowBgAlpha(backgroundAlpha.get())
79-
window(name, flags = ImGuiWindowFlags.NoCollapse) {
80-
val noScroll = if (autoScroll.get()) ImGuiWindowFlags.NoScrollbar or ImGuiWindowFlags.NoScrollWithMouse else 0
81-
if (mc.currentScreen == LambdaScreen) {
82-
checkbox("Auto-Scroll", autoScroll)
83-
sameLine()
84-
checkbox("Warp Text", wrapText)
85-
sameLine()
86-
checkbox("Show Debug", showDebug)
87-
checkbox("Show Success", showSuccess)
88-
sameLine()
89-
checkbox("Show Warning", showWarning)
90-
sameLine()
91-
checkbox("Show Error", showError)
92-
checkbox("Show System", showSystem)
93-
slider("Background Alpha", backgroundAlpha, 0.0f, 1.0f)
94-
button("Clear") { clear() }
95-
}
96-
child("Log Content", extraFlags = noScroll) {
97-
if (wrapText.get()) ImGui.pushTextWrapPos()
79+
val noScroll = if (autoScroll.get()) ImGuiWindowFlags.NoScrollbar or ImGuiWindowFlags.NoScrollWithMouse else 0
80+
if (mc.currentScreen == LambdaScreen) {
81+
checkbox("Auto-Scroll", autoScroll)
82+
sameLine()
83+
checkbox("Warp Text", wrapText)
84+
sameLine()
85+
checkbox("Show Debug", showDebug)
86+
checkbox("Show Success", showSuccess)
87+
sameLine()
88+
checkbox("Show Warning", showWarning)
89+
sameLine()
90+
checkbox("Show Error", showError)
91+
checkbox("Show System", showSystem)
92+
slider("Background Alpha", backgroundAlpha, 0.0f, 1.0f)
93+
button("Clear") { clear() }
94+
}
95+
child("Log Content", extraFlags = noScroll) {
96+
if (wrapText.get()) ImGui.pushTextWrapPos()
9897

99-
logs.forEach { logEntry ->
100-
if (shouldDisplay(logEntry)) {
101-
val type = logEntry.type
102-
val (logTypeStr, color) = when (type) {
103-
LogType.Debug -> Pair("[DEBUG]", type.color)
104-
LogType.Success -> Pair("[SUCCESS]", type.color)
105-
LogType.Warning -> Pair("[WARNING]", type.color)
106-
LogType.Error -> Pair("[ERROR]", type.color)
107-
LogType.System -> Pair("[SYSTEM]", type.color)
108-
}
98+
logs.forEach { logEntry ->
99+
if (shouldDisplay(logEntry)) {
100+
val type = logEntry.type
101+
val (logTypeStr, color) = when (type) {
102+
LogType.Debug -> Pair("[DEBUG]", type.color)
103+
LogType.Success -> Pair("[SUCCESS]", type.color)
104+
LogType.Warning -> Pair("[WARNING]", type.color)
105+
LogType.Error -> Pair("[ERROR]", type.color)
106+
LogType.System -> Pair("[SYSTEM]", type.color)
107+
}
109108

110-
val floats = floatArrayOf(0f, 0f, 0f)
111-
val (r, g, b) = color.getColorComponents(floats)
112-
ImGui.pushStyleColor(ImGuiCol.Text, r, g, b, color.a.toFloat())
113-
if (logEntry.type == LogType.System) {
114-
text("$logTypeStr ${logEntry.message}")
115-
} else {
116-
treeNode("$logTypeStr ${logEntry.message}", logEntry.uuid) {
117-
logEntry.extraContext
118-
.filterNotNull()
119-
.forEach {
120-
text(it)
121-
}
122-
}
109+
val floats = floatArrayOf(0f, 0f, 0f)
110+
val (r, g, b) = color.getColorComponents(floats)
111+
ImGui.pushStyleColor(ImGuiCol.Text, r, g, b, color.a.toFloat())
112+
if (logEntry.type == LogType.System) {
113+
text("$logTypeStr ${logEntry.message}")
114+
} else {
115+
treeNode("$logTypeStr ${logEntry.message}", logEntry.uuid) {
116+
logEntry.extraContext
117+
.filterNotNull()
118+
.forEach {
119+
text(it)
120+
}
123121
}
124-
ImGui.popStyleColor()
125122
}
123+
ImGui.popStyleColor()
126124
}
125+
}
127126

128-
if (wrapText.get()) ImGui.popTextWrapPos()
127+
if (wrapText.get()) ImGui.popTextWrapPos()
129128

130-
if (autoScroll.get()) {
131-
ImGui.setScrollHereY(1f)
132-
}
129+
if (autoScroll.get()) {
130+
ImGui.setScrollHereY(1f)
133131
}
134132
}
135133
}

src/main/kotlin/com/lambda/interaction/request/LogContext.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface LogContext {
3535
fun BlockHitResult.getLogContextBuilder(): LogContextBuilder.() -> Unit = {
3636
group("Block Hit Result") {
3737
value("Side", side)
38-
value("Block Pos", blockPos)
38+
text(blockPos.getLogContextBuilder())
3939
value("Pos", pos)
4040
}
4141
}

src/main/kotlin/com/lambda/interaction/request/rotating/RotationManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import com.lambda.interaction.request.RequestHandler
3434
import com.lambda.interaction.request.rotating.Rotation.Companion.slerp
3535
import com.lambda.interaction.request.rotating.visibilty.lookAt
3636
import com.lambda.module.hud.ManagerDebugLoggers.rotationManagerLogger
37-
import com.lambda.module.modules.client.Baritone
3837
import com.lambda.threading.runGameScheduled
3938
import com.lambda.threading.runSafe
4039
import com.lambda.util.extension.partialTicks

0 commit comments

Comments
 (0)