-
-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Esp): sub package for modes (#5603)
- Loading branch information
Showing
9 changed files
with
171 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...in/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/esp/modes/EspBoxMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
* | ||
* Copyright (c) 2015 - 2025 CCBlueX | ||
* | ||
* LiquidBounce is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* LiquidBounce is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.ccbluex.liquidbounce.features.module.modules.render.esp.modes | ||
|
||
import net.ccbluex.liquidbounce.event.events.WorldRenderEvent | ||
import net.ccbluex.liquidbounce.event.handler | ||
import net.ccbluex.liquidbounce.features.module.modules.render.esp.ModuleESP.getColor | ||
import net.ccbluex.liquidbounce.render.BoxRenderer | ||
import net.ccbluex.liquidbounce.render.renderEnvironmentForWorld | ||
import net.ccbluex.liquidbounce.render.withPositionRelativeToCamera | ||
import net.ccbluex.liquidbounce.utils.entity.RenderedEntities | ||
import net.ccbluex.liquidbounce.utils.entity.interpolateCurrentPosition | ||
import net.minecraft.util.math.Box | ||
|
||
object EspBoxMode : EspMode("Box") { | ||
|
||
private val outline by boolean("Outline", true) | ||
|
||
@Suppress("unused") | ||
private val renderHandler = handler<WorldRenderEvent> { event -> | ||
val matrixStack = event.matrixStack | ||
val entitiesWithBoxes = RenderedEntities.map { entity -> | ||
val dimensions = entity.getDimensions(entity.pose) | ||
|
||
val d = dimensions.width.toDouble() / 2.0 | ||
|
||
entity to Box(-d, 0.0, -d, d, dimensions.height.toDouble(), d).expand(0.05) | ||
} | ||
|
||
renderEnvironmentForWorld(matrixStack) { | ||
BoxRenderer.Companion.drawWith(this) { | ||
entitiesWithBoxes.forEach { (entity, box) -> | ||
val pos = entity.interpolateCurrentPosition(event.partialTicks) | ||
val color = getColor(entity) | ||
|
||
val baseColor = color.with(a = 50) | ||
val outlineColor = color.with(a = 100) | ||
|
||
withPositionRelativeToCamera(pos) { | ||
drawBox( | ||
box, | ||
baseColor, | ||
outlineColor.takeIf { outline } | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...n/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/esp/modes/EspGlowMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
* | ||
* Copyright (c) 2015 - 2025 CCBlueX | ||
* | ||
* LiquidBounce is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* LiquidBounce is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.ccbluex.liquidbounce.features.module.modules.render.esp.modes | ||
|
||
object EspGlowMode : EspMode("Glow", requiresTrueSight = true) |
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/esp/modes/EspMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
* | ||
* Copyright (c) 2015 - 2025 CCBlueX | ||
* | ||
* LiquidBounce is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* LiquidBounce is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.ccbluex.liquidbounce.features.module.modules.render.esp.modes | ||
|
||
import net.ccbluex.liquidbounce.config.types.Choice | ||
import net.ccbluex.liquidbounce.features.module.modules.render.esp.ModuleESP.modes | ||
|
||
sealed class EspMode( | ||
name: String, | ||
val requiresTrueSight: Boolean = false | ||
) : Choice(name) { | ||
override val parent | ||
get() = modes | ||
} |
21 changes: 21 additions & 0 deletions
21
...otlin/net/ccbluex/liquidbounce/features/module/modules/render/esp/modes/EspOutlineMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
* | ||
* Copyright (c) 2015 - 2025 CCBlueX | ||
* | ||
* LiquidBounce is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* LiquidBounce is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.ccbluex.liquidbounce.features.module.modules.render.esp.modes | ||
|
||
object EspOutlineMode : EspMode("Outline", requiresTrueSight = true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters