Skip to content

Commit

Permalink
feat(legacy): Added Backtrack Player Render (#3077)
Browse files Browse the repository at this point in the history
- Added Backtrack "Player" Render option. (Closes: #1463)
- Fixed Sprint not resetting correctly after toggled off. (#2580)
- Fixed FlagCheck GhostBlock less false flags.
- Simplified KillAura isEnemy function.
  • Loading branch information
EclipsesDev committed May 22, 2024
1 parent 2858a85 commit 46e3a7c
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.FloatValue
import net.ccbluex.liquidbounce.value.IntegerValue
import net.ccbluex.liquidbounce.value.ListValue
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.player.EntityPlayer
Expand Down Expand Up @@ -81,11 +82,11 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) {
private val smart by BoolValue("Smart", true) { mode == "Modern" }

// ESP
private val esp by BoolValue("ESP", true, subjective = true) { mode == "Modern" }
private val rainbow by BoolValue("Rainbow", true, subjective = true) { mode == "Modern" && esp }
private val red by IntegerValue("R", 0, 0..255, subjective = true) { !rainbow && mode == "Modern" && esp }
private val green by IntegerValue("G", 255, 0..255, subjective = true) { !rainbow && mode == "Modern" && esp }
private val blue by IntegerValue("B", 0, 0..255, subjective = true) { !rainbow && mode == "Modern" && esp }
private val espMode by ListValue("ESP-Mode", arrayOf("None", "Box", "Player"), "Box", subjective = true) { mode == "Modern" }
private val rainbow by BoolValue("Rainbow", true, subjective = true) { mode == "Modern" && espMode == "Box" }
private val red by IntegerValue("R", 0, 0..255, subjective = true) { !rainbow && mode == "Modern" && espMode == "Box" }
private val green by IntegerValue("G", 255, 0..255, subjective = true) { !rainbow && mode == "Modern" && espMode == "Box" }
private val blue by IntegerValue("B", 0, 0..255, subjective = true) { !rainbow && mode == "Modern" && espMode == "Box" }

private val packetQueue = LinkedHashMap<Packet<*>, Long>()
private val positions = mutableListOf<Pair<Vec3, Long>>()
Expand All @@ -105,6 +106,8 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) {

private val nonDelayedSoundSubstrings = arrayOf("game.player.hurt", "game.player.die")

private var backtrackFakePlayer: EntityOtherPlayerMP? = null

@EventTarget
fun onPacket(event: PacketEvent) {
val packet = event.packet
Expand Down Expand Up @@ -282,6 +285,11 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) {
} else {
clearPackets()
globalTimer.reset()

backtrackFakePlayer?.let {
mc.theWorld?.removeEntityFromWorld(it.entityId)
backtrackFakePlayer = null
}
}
}

Expand Down Expand Up @@ -343,35 +351,78 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) {
}

"modern" -> {
if (!shouldBacktrack() || packetQueue.isEmpty() || !shouldDraw || !esp)
if (!shouldBacktrack() || packetQueue.isEmpty() || !shouldDraw) {
backtrackFakePlayer?.apply {
mc.theWorld.removeEntityFromWorld(entityId)
backtrackFakePlayer = null
}
return
}

val renderManager = mc.renderManager

target?.run {
val targetEntity = target as IMixinEntity

if (targetEntity.truePos) {

val x =
targetEntity.trueX - renderManager.renderPosX
val y =
targetEntity.trueY - renderManager.renderPosY
val z =
targetEntity.trueZ - renderManager.renderPosZ

val axisAlignedBB = entityBoundingBox.offset(-posX, -posY, -posZ).offset(x, y, z)

drawBacktrackBox(
AxisAlignedBB.fromBounds(
axisAlignedBB.minX,
axisAlignedBB.minY,
axisAlignedBB.minZ,
axisAlignedBB.maxX,
axisAlignedBB.maxY,
axisAlignedBB.maxZ
), color
)
when (espMode) {
"Box" -> {
val x = targetEntity.trueX - renderManager.renderPosX
val y = targetEntity.trueY - renderManager.renderPosY
val z = targetEntity.trueZ - renderManager.renderPosZ

val axisAlignedBB = entityBoundingBox.offset(-posX, -posY, -posZ).offset(x, y, z)

drawBacktrackBox(
AxisAlignedBB.fromBounds(
axisAlignedBB.minX,
axisAlignedBB.minY,
axisAlignedBB.minZ,
axisAlignedBB.maxX,
axisAlignedBB.maxY,
axisAlignedBB.maxZ
), color
)
}
"Player" -> {
val targetRender = target as EntityPlayer
val faker = EntityOtherPlayerMP(mc.theWorld, targetRender.gameProfile)

if (backtrackFakePlayer == null) {
faker.rotationYawHead = targetRender.rotationYawHead
faker.renderYawOffset = targetRender.renderYawOffset
faker.copyLocationAndAnglesFrom(targetRender)
faker.rotationYawHead = targetRender.rotationYawHead

faker.inventory.copyInventory(targetRender.inventory)

faker.swingProgressInt = targetRender.swingProgressInt
faker.limbSwing = targetRender.limbSwing
faker.limbSwingAmount = targetRender.limbSwingAmount

faker.setPositionAndUpdate(
targetEntity.trueX,
targetEntity.trueY,
targetEntity.trueZ
)

// Mark the faker as a fake player (To prevent KillAura attacking it)
faker.customNameTag = "FAKE_PLAYER"
faker.alwaysRenderNameTag = false

mc.theWorld.addEntityToWorld(-1337, faker)
backtrackFakePlayer = faker
} else {
backtrackFakePlayer?.apply {
mc.theWorld.removeEntityFromWorld(entityId)
backtrackFakePlayer = null
}
}
}
else -> {
return@run
}
}
}
}
}
Expand Down Expand Up @@ -404,6 +455,11 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) {
override fun onDisable() {
clearPackets()
backtrackedPlayer.clear()

backtrackFakePlayer?.let {
mc.theWorld?.removeEntityFromWorld(it.entityId)
backtrackFakePlayer = null
}
}

private fun handlePackets() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import net.ccbluex.liquidbounce.event.*
import net.ccbluex.liquidbounce.event.EventManager.callEvent
import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.modules.misc.AntiBot.isBot
import net.ccbluex.liquidbounce.features.module.modules.misc.Teams
import net.ccbluex.liquidbounce.features.module.modules.render.FreeCam
import net.ccbluex.liquidbounce.features.module.modules.world.Fucker
import net.ccbluex.liquidbounce.features.module.modules.world.Nuker
Expand All @@ -20,11 +18,7 @@ import net.ccbluex.liquidbounce.utils.ClientUtils.runTimeTicks
import net.ccbluex.liquidbounce.utils.CooldownHelper.getAttackCooldownProgress
import net.ccbluex.liquidbounce.utils.CooldownHelper.resetLastAttackedTicks
import net.ccbluex.liquidbounce.utils.EntityUtils.isLookingOnEntities
import net.ccbluex.liquidbounce.utils.EntityUtils.targetAnimals
import net.ccbluex.liquidbounce.utils.EntityUtils.targetDead
import net.ccbluex.liquidbounce.utils.EntityUtils.targetInvisible
import net.ccbluex.liquidbounce.utils.EntityUtils.targetMobs
import net.ccbluex.liquidbounce.utils.EntityUtils.targetPlayer
import net.ccbluex.liquidbounce.utils.EntityUtils.isSelected
import net.ccbluex.liquidbounce.utils.MovementUtils.isMoving
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPacket
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPackets
Expand Down Expand Up @@ -698,21 +692,7 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R, hideModule
* Check if [entity] is selected as enemy with current target options and other modules
*/
private fun isEnemy(entity: Entity?): Boolean {
if (entity is EntityLivingBase && (targetDead || isAlive(entity)) && entity != mc.thePlayer) {
if (!targetInvisible && entity.isInvisible) return false

if (targetPlayer && entity is EntityPlayer) {
if (entity.isSpectator || isBot(entity)) return false

if (entity.isClientFriend() && !NoFriends.handleEvents()) return false

return !Teams.handleEvents() || !Teams.isInYourTeam(entity)
}

return targetMobs && entity.isMob() || targetAnimals && entity.isAnimal()
}

return false
return isSelected(entity, true)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ object FlagCheck : Module("FlagCheck", Category.MISC, gameDetecting = true, hide

if (currentTime - timestamp > 500) {
val block = world.getBlockState(blockPos).block
if (block == Blocks.air && player.isSwingInProgress
if (block == Blocks.air && player.swingProgressInt > 3
&& successfulPlacements != blockPos && !player.isBlocking
&& !KillAura.renderBlocking && !KillAura.blockStatus) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ object Sprint : Module("Sprint", Category.MOVEMENT, gameDetecting = false, hideM

val isLegitModeActive = mode == "Legit"

if (!handleEvents()) {
return true
}

val modifiedForward = if (currentRotation != null && rotationData?.strict == true) {
player.movementInput.moveForward
} else {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/ccbluex/liquidbounce/utils/BlinkUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ object BlinkUtils {
faker.copyLocationAndAnglesFrom(thePlayer)
faker.rotationYawHead = thePlayer.rotationYawHead
faker.inventory = thePlayer.inventory
faker.customNameTag = "FAKE_PLAYER"
mc.theWorld.addEntityToWorld(-1337, faker)

fakePlayer = faker
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/ccbluex/liquidbounce/utils/EntityUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ object EntityUtils : MinecraftInstance() {

if (entity.isSpectator) return false

if (entity.customNameTag == "FAKE_PLAYER") return false

return !Teams.handleEvents() || !Teams.isInYourTeam(entity)
}
return true
Expand Down

0 comments on commit 46e3a7c

Please sign in to comment.