Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
858553d
initial logger hud
beanbag44 Aug 21, 2025
2fccb8c
add logs
beanbag44 Aug 21, 2025
52f3af1
settings in the module
beanbag44 Aug 21, 2025
5e80a86
background
beanbag44 Aug 21, 2025
fdd5c91
better auto scroll and background alpha setting
beanbag44 Aug 21, 2025
f35adad
log chat warnings too
beanbag44 Aug 21, 2025
b4fb18a
lot type and state when starting and breaking block
beanbag44 Aug 21, 2025
03adc96
logger gui improvements
beanbag44 Aug 21, 2025
859e0d2
BreakInfo toString and more debug statements / edits
beanbag44 Aug 21, 2025
2787e2d
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Aug 22, 2025
fb96e62
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Aug 24, 2025
fb7da09
Merge remote-tracking branch 'NeoLambda/feature/manager-loggers' into…
beanbag44 Aug 31, 2025
b4afde9
place manager logs and other manager debug logger hud elements
beanbag44 Aug 31, 2025
61ebb81
all individual manager debug logger toggles inside one hud module
beanbag44 Sep 1, 2025
a988f1e
hotbar manager debug logs
beanbag44 Sep 1, 2025
98f9f87
log new stage before processing request
beanbag44 Sep 1, 2025
e6f2076
interaction manager logs
beanbag44 Sep 1, 2025
b16b248
rotation manager logs
beanbag44 Sep 2, 2025
df165b2
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Sep 2, 2025
1f2a1a4
fix treeNode label / id argument order and inline textColored logic w…
beanbag44 Sep 5, 2025
f8beaff
a start to log contexts
beanbag44 Sep 5, 2025
282f90f
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Sep 8, 2025
ee5a026
compile fixes
beanbag44 Sep 8, 2025
5603b69
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Sep 8, 2025
a9c13ea
empty replace for sameLine calls
beanbag44 Sep 9, 2025
e86389e
BreakRequest toLogContext
beanbag44 Sep 9, 2025
d77d2e1
InteractRequest toLogContext
beanbag44 Sep 9, 2025
8f85012
InventoryRequest toLogContext
beanbag44 Sep 9, 2025
3804abb
PlaceRequest toLogContext
beanbag44 Sep 9, 2025
10df72d
RotationRequest toLogContext
beanbag44 Sep 9, 2025
b629941
BreakInfo and SwapInfo toLogContext
beanbag44 Sep 9, 2025
ca437fa
InteractionInfo toLogContext
beanbag44 Sep 9, 2025
dbdab88
PlaceInfo toLogContext
beanbag44 Sep 9, 2025
a5d4eb4
toLogContext for all manager contexts
beanbag44 Sep 9, 2025
582f1b3
value builder function
beanbag44 Sep 9, 2025
9a45a50
group build function
beanbag44 Sep 9, 2025
42eef99
annotation correction
beanbag44 Sep 9, 2025
aa6966c
better break manager logs and fancy styling
beanbag44 Sep 10, 2025
276dea2
hopefully better sameLine builder function
beanbag44 Sep 10, 2025
33ec725
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Sep 14, 2025
77fecd7
use hud window
beanbag44 Sep 14, 2025
2183814
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Sep 14, 2025
e409a2e
improved interaction manager logs
beanbag44 Sep 14, 2025
6ec157b
improved place manager logs
beanbag44 Sep 14, 2025
54d5c15
improved rotation manager logs
beanbag44 Sep 14, 2025
b93e060
move logger settings to hud module settings. This also saves the sett…
beanbag44 Sep 14, 2025
3f6dee3
Merge branch '1.21.5' into feature/manager-loggers
beanbag44 Sep 15, 2025
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
Prev Previous commit
Next Next commit
group build function
  • Loading branch information
beanbag44 committed Sep 9, 2025
commit 9a45a506d90b541ed319f6d3dbe003e9af8bcdf8
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import com.lambda.graphics.renderer.esp.DirectionMask
import com.lambda.graphics.renderer.esp.DirectionMask.exclude
import com.lambda.graphics.renderer.esp.ShapeBuilder
import com.lambda.interaction.material.StackSelection
import com.lambda.interaction.request.DebugLogger.LogEntry.Companion.toLogContext
import com.lambda.interaction.request.LogContext
import com.lambda.interaction.request.LogContext.Companion.buildLogContext
import com.lambda.interaction.request.LogContext.Companion.toLogContext
import com.lambda.interaction.request.breaking.BreakConfig
import com.lambda.interaction.request.hotbar.HotbarManager
import com.lambda.interaction.request.rotating.RotationRequest
Expand Down Expand Up @@ -79,15 +79,15 @@ data class BreakContext(

override fun toLogContext() =
buildLogContext {
text("Break Context:")
pushTab()
text(blockPos.toLogContext())
text(result.toLogContext())
text(rotation.toLogContext())
value("Hotbar Index", hotbarIndex)
value("Instant Break", instantBreak)
value("Cached State", cachedState)
value("Expected State", expectedState)
value("Sort Mode", sortMode)
group("Break Context") {
text(blockPos.toLogContext())
text(result.toLogContext())
text(rotation.toLogContext())
value("Hotbar Index", hotbarIndex)
value("Instant Break", instantBreak)
value("Cached State", cachedState)
value("Expected State", expectedState)
value("Sort Mode", sortMode)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package com.lambda.interaction.construction.context

import com.lambda.graphics.renderer.esp.DirectionMask.mask
import com.lambda.graphics.renderer.esp.ShapeBuilder
import com.lambda.interaction.request.DebugLogger.LogEntry.Companion.toLogContext
import com.lambda.interaction.request.LogContext
import com.lambda.interaction.request.LogContext.Companion.buildLogContext
import com.lambda.interaction.request.LogContext.Companion.toLogContext
import com.lambda.interaction.request.Request.Companion.submit
import com.lambda.interaction.request.hotbar.HotbarManager
import com.lambda.interaction.request.hotbar.HotbarRequest
Expand Down Expand Up @@ -74,13 +74,13 @@ class InteractionContext(

override fun toLogContext() =
buildLogContext {
text("Interaction Context:")
pushTab()
text(blockPos.toLogContext())
text(result.toLogContext())
text(rotation.toLogContext())
value("Hotbar Index", hotbarIndex)
value("Cached State", cachedState)
value("Expected State", expectedState)
group("Interaction Context") {
text(blockPos.toLogContext())
text(result.toLogContext())
text(rotation.toLogContext())
value("Hotbar Index", hotbarIndex)
value("Cached State", cachedState)
value("Expected State", expectedState)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ package com.lambda.interaction.construction.context
import com.lambda.Lambda.mc
import com.lambda.graphics.renderer.esp.DirectionMask.mask
import com.lambda.graphics.renderer.esp.ShapeBuilder
import com.lambda.interaction.request.DebugLogger.LogEntry.Companion.toLogContext
import com.lambda.interaction.request.LogContext
import com.lambda.interaction.request.LogContext.Companion.buildLogContext
import com.lambda.interaction.request.LogContext.Companion.toLogContext
import com.lambda.interaction.request.Request.Companion.submit
import com.lambda.interaction.request.hotbar.HotbarManager
import com.lambda.interaction.request.hotbar.HotbarRequest
Expand Down Expand Up @@ -85,16 +85,16 @@ data class PlaceContext(

override fun toLogContext() =
buildLogContext {
text("Place Context:")
pushTab()
text(blockPos.toLogContext())
text(result.toLogContext())
text(rotation.toLogContext())
value("Hotbar Index", hotbarIndex)
value("Cached State", cachedState)
value("Expected State", expectedState)
value("Sneak", sneak)
value("Inside Block", insideBlock)
value("Current Dir Is Invalid", currentDirIsValid)
group("Place Context") {
text(blockPos.toLogContext())
text(result.toLogContext())
text(rotation.toLogContext())
value("Hotbar Index", hotbarIndex)
value("Cached State", cachedState)
value("Expected State", expectedState)
value("Sneak", sneak)
value("Inside Block", insideBlock)
value("Current Dir Is Invalid", currentDirIsValid)
}
}
}
17 changes: 0 additions & 17 deletions src/main/kotlin/com/lambda/interaction/request/DebugLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,6 @@ class DebugLogger(
vararg val extraContext: String?
) {
val uuid = UUID.randomUUID().toString()
companion object {
fun BlockPos.toLogContext(): String {
val pos = if (this is BlockPos.Mutable) toImmutable() else this
return buildLogContext {
value("Block Pos", pos.toShortString())
}
}

fun BlockHitResult.toLogContext() =
buildLogContext {
text("Block Hit Result:")
pushTab()
value("Side", side)
value("Block Pos", blockPos)
value("Pos", pos)
}
}
}

enum class LogType(val color: Color) {
Expand Down
34 changes: 30 additions & 4 deletions src/main/kotlin/com/lambda/interaction/request/LogContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,42 @@

package com.lambda.interaction.request

import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos

interface LogContext {
fun toLogContext(): String

companion object {
@DslMarker
private annotation class LogContextDsl

fun BlockPos.toLogContext(): String {
val pos = if (this is BlockPos.Mutable) toImmutable() else this
return buildLogContext {
value("Block Pos", pos.toShortString())
}
}

fun BlockHitResult.toLogContext() =
buildLogContext {
group("Block Hit Result") {
value("Side", side)
value("Block Pos", blockPos)
value("Pos", pos)
}
}

@LogContextDsl
fun buildLogContext(builder: LogContextBuilder.() -> Unit): String =
LogContextBuilder().apply(builder).build()
fun buildLogContext(tabMin: Int = 0, builder: LogContextBuilder.() -> Unit): String =
LogContextBuilder(tabMin).apply(builder).build()

private fun LogContextBuilder.build() = logContext

class LogContextBuilder {
class LogContextBuilder(val tabMin: Int = 0) {
var logContext = ""

private var tabs = 0
private var tabs = tabMin

@LogContextDsl
fun sameLine() =
Expand All @@ -55,6 +74,12 @@ interface LogContext {
text("$name: $value")
}

@LogContextDsl
fun group(name: String, builder: LogContextBuilder.() -> Unit) {
text("$name:")
text(LogContextBuilder(tabs + 1).apply(builder).build())
}

@LogContextDsl
fun pushTab() {
tabs++
Expand All @@ -63,6 +88,7 @@ interface LogContext {
@LogContextDsl
fun popTab() {
tabs--
if (tabs < tabMin) throw IllegalStateException("Cannot reduce tabs beneath the minimum tab count")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.lambda.interaction.request.breaking

import com.lambda.interaction.construction.context.BreakContext
import com.lambda.interaction.request.ActionInfo
import com.lambda.interaction.request.DebugLogger.LogEntry.Companion.toLogContext
import com.lambda.interaction.request.LogContext
import com.lambda.interaction.request.LogContext.Companion.buildLogContext
import com.lambda.interaction.request.breaking.BreakInfo.BreakType.Primary
Expand Down Expand Up @@ -153,26 +152,25 @@ data class BreakInfo(

override fun toLogContext() =
buildLogContext {
text("Break Info:")
pushTab()
value("Type", type)
text(context.blockPos.toLogContext())
text(context.toLogContext())
text("Details:")
pushTab()
value("Should Progress", shouldProgress)
value("Rebreak Potential", rebreakPotential)
text(swapInfo.toLogContext())
value("Swap Stack", swapStack)
value("Updated This Tick", updatedThisTick)
value("Updated Pre-Processing This Tick", updatedPreProcessingThisTick)
value("Progressed This Tick", progressedThisTick)
value("Breaking", breaking)
value("Abandoned", abandoned)
value("Breaking Ticks", breakingTicks)
value("Sounds Cooldown", soundsCooldown)
value("Vanilla Instant Breakable", vanillaInstantBreakable)
value("Rebreakable", rebreakable)
group("Break Info") {
value("Type", type)
text(context.toLogContext())
group("Details") {
value("Should Progress", shouldProgress)
value("Rebreak Potential", rebreakPotential)
text(swapInfo.toLogContext())
value("Swap Stack", swapStack)
value("Updated This Tick", updatedThisTick)
value("Updated Pre-Processing This Tick", updatedPreProcessingThisTick)
value("Progressed This Tick", progressedThisTick)
value("Breaking", breaking)
value("Abandoned", abandoned)
value("Breaking Ticks", breakingTicks)
value("Sounds Cooldown", soundsCooldown)
value("Vanilla Instant Breakable", vanillaInstantBreakable)
value("Rebreakable", rebreakable)
}
}
}

override fun toString() = "$type, ${context.cachedState}, ${context.blockPos}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ data class BreakRequest(

override fun toLogContext() =
buildLogContext {
text("Break Request")
pushTab()
value("Request ID", requestID)
value("Contexts", contexts.size)
text("Callbacks:")
pushTab()
value("onStart", onStart != null)
value("onUpdate", onUpdate != null)
value("onStop", onStop != null)
value("onCancel", onCancel != null)
value("onItemDrop", onItemDrop != null)
value("onReBreakStart", onReBreakStart != null)
value("onReBreak", onReBreak != null)
group("Break Request") {
value("Request ID", requestID)
value("Contexts", contexts.size)
group("Callbacks") {
value("onStart", onStart != null)
value("onUpdate", onUpdate != null)
value("onStop", onStop != null)
value("onCancel", onCancel != null)
value("onItemDrop", onItemDrop != null)
value("onReBreakStart", onReBreakStart != null)
value("onReBreak", onReBreak != null)
}
}
}

@DslMarker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ data class SwapInfo(

override fun toLogContext() =
buildLogContext {
text("Swap Info:")
pushTab()
value("Type", type)
value("Swap", swap)
value("Min Keep Ticks", minKeepTicks)
value("Valid Swap", validSwap)
group("Swap Info") {
value("Type", type)
value("Swap", swap)
value("Min Keep Ticks", minKeepTicks)
value("Valid Swap", validSwap)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ class HotbarRequest(

override fun toLogContext() =
buildLogContext {
text("Hotbar Request:")
pushTab()
value("Request ID", requestID)
value("Slot", slot)
value("Keep Ticks", keepTicks)
value("Swap Pause", swapPause)
value("Swap Pause Age", swapPauseAge)
value("Active Request Age", activeRequestAge)
group("Hotbar Request") {
value("Request ID", requestID)
value("Slot", slot)
value("Keep Ticks", keepTicks)
value("Swap Pause", swapPause)
value("Swap Pause Age", swapPauseAge)
value("Active Request Age", activeRequestAge)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ data class InteractRequest(

override fun toLogContext() =
buildLogContext {
text("Interact Request:")
pushTab()
value("Request ID", requestID)
value("Contexts", contexts.size)
group("Interact Request") {
value("Request ID", requestID)
value("Contexts", contexts.size)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ data class InteractionInfo(
) : ActionInfo, InteractConfig by config, LogContext {
override fun toLogContext() =
buildLogContext {
text("Interaction Info:")
pushTab()
text(context.toLogContext())
group("Interaction Info") {
text(context.toLogContext())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class InventoryRequest(

override fun toLogContext() =
buildLogContext {
text("Inventory Request:")
pushTab()
value("Request ID", requestID)
group("Inventory Request") {
value("Request ID", requestID)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ data class PlaceInfo(
) : ActionInfo, LogContext {
override fun toLogContext() =
buildLogContext {
text("Place Info:")
pushTab()
text(context.toLogContext())
text("Callbacks:")
pushTab()
value("onPlace", onPlace != null)
group("Place Info") {
text(context.toLogContext())
group("Callbacks") {
value("onPlace", onPlace != null)
}
}
}
}
Loading