diff --git a/src/main/kotlin/com/lambda/module/modules/render/BlockESP.kt b/src/main/kotlin/com/lambda/module/modules/render/BlockESP.kt index fc9789b4c..cf04d4b81 100644 --- a/src/main/kotlin/com/lambda/module/modules/render/BlockESP.kt +++ b/src/main/kotlin/com/lambda/module/modules/render/BlockESP.kt @@ -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) @@ -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) } diff --git a/src/main/kotlin/com/lambda/util/extension/World.kt b/src/main/kotlin/com/lambda/util/extension/World.kt index b053dd8a6..a1b2f5124 100644 --- a/src/main/kotlin/com/lambda/util/extension/World.kt +++ b/src/main/kotlin/com/lambda/util/extension/World.kt @@ -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) + 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