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
6 changes: 5 additions & 1 deletion src/main/kotlin/com/lambda/module/modules/render/BlockESP.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ object BlockESP : Module(
private val mesh by setting("Mesh", true, "Connect similar adjacent blocks") { searchBlocks }.onValueChange(::rebuildMesh)

private val useBlockColor by setting("Use Block Color", false, "Use the color of the block instead") { searchBlocks }.onValueChange(::rebuildMesh)
private val blockColorAlpha by setting("Block Color Alpha", 0.3, 0.1..1.0, 0.05) { searchBlocks && useBlockColor }.onValueChange { _, _ -> ::rebuildMesh }

private val faceColor by setting("Face Color", Color(100, 150, 255, 51), "Color of the surfaces") { searchBlocks && drawFaces && !useBlockColor }.onValueChange(::rebuildMesh)
private val outlineColor by setting("Outline Color", Color(100, 150, 255, 128), "Color of the outlines") { searchBlocks && drawOutlines && !useBlockColor }.onValueChange(::rebuildMesh)

Expand All @@ -76,13 +78,15 @@ object BlockESP : Module(
} else DirectionMask.ALL

runSafe {
// TODO: Add custom color option when map options are implemented
val extractedColor = blockColor(state, position.toBlockPos())
val finalColor = Color(extractedColor.red, extractedColor.green, extractedColor.blue, (blockColorAlpha * 255).toInt())
val pos = position.toBlockPos()
val shape = state.getOutlineShape(world, pos)
val worldBox = if (shape.isEmpty) Box(pos) else shape.boundingBox.offset(pos)
box(worldBox) {
if (drawFaces)
filled(if (useBlockColor) extractedColor else faceColor, sides)
filled(if (useBlockColor) finalColor else faceColor, sides)
if (drawOutlines)
outline(if (useBlockColor) extractedColor else BlockESP.outlineColor, sides, BlockESP.outlineMode)
}
Expand Down
11 changes: 9 additions & 2 deletions src/main/kotlin/com/lambda/util/extension/World.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ fun SafeContext.collisionShape(state: BlockState, pos: BlockPos): VoxelShape =
fun SafeContext.outlineShape(state: BlockState, pos: BlockPos) =
state.getOutlineShape(world, pos).offset(pos)

fun SafeContext.blockColor(state: BlockState, pos: BlockPos) =
Color(state.getMapColor(world, pos).color)
fun SafeContext.blockColor(state: BlockState, pos: BlockPos): Color {
return when (state.block) {
Blocks.ENDER_CHEST -> Color(0xFF00FF)
Blocks.NETHER_PORTAL -> Color(0xaa00aa)
Blocks.END_PORTAL -> Color(0xFF00FF)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think pink is not the right color for end portal

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks "darker" when the alpha is set to something, if you want it to be something entirely different do you want to suggest something?
2025-12-22_18 04 06

else ->
Color(state.getMapColor(world, pos).color, false)
}
}

fun World.getBlockState(x: Int, y: Int, z: Int): BlockState {
if (isOutOfHeightLimit(y)) return Blocks.VOID_AIR.defaultState
Expand Down
Loading