From df981807bd6f0708d561ef968695ff49ea6e1938 Mon Sep 17 00:00:00 2001 From: mems01 <70612656+mems01@users.noreply.github.com> Date: Tue, 30 Jul 2024 00:01:13 +0300 Subject: [PATCH] feat(legacy): A bit of a more realistic speed change for the Relative Smoother Rotation mode. (#3561) --- .../features/module/modules/combat/Aimbot.kt | 1 - .../module/modules/combat/Backtrack.kt | 42 ++++++++++++++----- .../module/modules/combat/KillAura.kt | 12 ++++-- .../module/modules/combat/TimerRange.kt | 4 +- .../modules/world/scaffolds/Scaffold.kt | 1 - .../liquidbounce/utils/RotationUtils.kt | 19 ++------- 6 files changed, 45 insertions(+), 34 deletions(-) diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Aimbot.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Aimbot.kt index a064db4a5a6..89041571c35 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Aimbot.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Aimbot.kt @@ -169,7 +169,6 @@ object Aimbot : Module("Aimbot", Category.COMBAT, hideModule = false) { searchCenter(boundingBox, outborder = false, random = false, - useSpots = false, predict = true, lookRange = range, attackRange = if (Reach.handleEvents()) Reach.combatReach else 3f, diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Backtrack.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Backtrack.kt index 40609777084..c4c622e0093 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Backtrack.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Backtrack.kt @@ -6,8 +6,8 @@ package net.ccbluex.liquidbounce.features.module.modules.combat import net.ccbluex.liquidbounce.event.* -import net.ccbluex.liquidbounce.features.module.Module 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.player.Blink @@ -81,11 +81,27 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) { private val smart by BoolValue("Smart", true) { mode == "Modern" } // ESP - val espMode by ListValue("ESP-Mode", arrayOf("None", "Box", "Player"), "Box", subjective = true) { mode == "Modern" } + 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 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, Long>() private val positions = mutableListOf>() @@ -168,9 +184,15 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) { "modern" -> { // Prevent cancelling packets when not needed - if (packetQueue.isEmpty() || !shouldBacktrack()) + if (packetQueue.isEmpty() && !shouldBacktrack()) return + // Flush if packetQueue is not empty when not needed + if (packetQueue.isNotEmpty() && !shouldBacktrack()) { + clearPackets() + return + } + when (packet) { // Ignore server related packets is C00Handshake, is C00PacketServerQuery, is S02PacketChat -> @@ -463,14 +485,14 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) { if (!packetQueue.isEmpty()) { delayForNextBacktrack = System.currentTimeMillis() + nextBacktrackDelay } - + synchronized(packetQueue) { if (handlePackets) PacketUtils.queuedPackets.addAll(packetQueue.keys) packetQueue.clear() } - + positions.clear() shouldRender = false ignoreWholeTick = true @@ -608,8 +630,8 @@ object Backtrack : Module("Backtrack", Category.COMBAT, hideModule = false) { fun shouldBacktrack() = System.currentTimeMillis() >= delayForNextBacktrack && target?.let { - !it.isDead && isEnemy(it) && (mc.thePlayer?.ticksExisted ?: 0) > 20 && !ignoreWholeTick - } ?: false + isEnemy(it) && (mc.thePlayer?.ticksExisted ?: 0) > 20 && !ignoreWholeTick + } ?: false private fun reset() { target = null diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt index 8f413fb8697..20ed0a50b48 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/KillAura.kt @@ -257,10 +257,12 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R, hideModule private val simulateShortStop by BoolValue("SimulateShortStop", false) { !noRotation } private val randomizeRotations by BoolValue("RandomizeRotations", true) { !noRotation } - private val useSpotsToRandomize by BoolValue("UseSpotsToRandomize", false) { randomizeRotations && !noRotation } private val outborder by BoolValue("Outborder", false) { !noRotation } - private val highestBodyPointToTargetValue: ListValue = object : ListValue("HighestBodyPointToTarget", arrayOf("Head", "Body", "Feet"), "Head") { + private val highestBodyPointToTargetValue: ListValue = object : ListValue("HighestBodyPointToTarget", + arrayOf("Head", "Body", "Feet"), + "Head" + ) { override fun isSupported() = !noRotation override fun onChange(oldValue: String, newValue: String): String { @@ -272,7 +274,10 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R, hideModule } private val highestBodyPointToTarget by highestBodyPointToTargetValue - private val lowestBodyPointToTargetValue: ListValue = object : ListValue("LowestBodyPointToTarget", arrayOf("Head", "Body", "Feet"), "Feet") { + private val lowestBodyPointToTargetValue: ListValue = object : ListValue("LowestBodyPointToTarget", + arrayOf("Head", "Body", "Feet"), + "Feet" + ) { override fun isSupported() = !noRotation override fun onChange(oldValue: String, newValue: String): String { @@ -915,7 +920,6 @@ object KillAura : Module("KillAura", Category.COMBAT, Keyboard.KEY_R, hideModule boundingBox, outborder && !attackTimer.hasTimePassed(attackDelay / 2), randomizeRotations, - useSpots = useSpotsToRandomize, predict = false, lookRange = range + scanRange, attackRange = range, diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/TimerRange.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/TimerRange.kt index 343146be7b2..ce600f26876 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/TimerRange.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/TimerRange.kt @@ -268,10 +268,10 @@ object TimerRange : Module("TimerRange", Category.COMBAT, hideModule = false) { player.setPosAndPrevPos(simPlayer.pos) - val distance = searchCenter(boundingBox, + val distance = searchCenter( + boundingBox, outborder = false, random = false, - useSpots = false, predict = true, lookRange = if (timerBoostMode == "Normal") rangeValue else randomRange, attackRange = if (Reach.handleEvents()) Reach.combatReach else 3f, diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt index fd687c73625..41a24fef58a 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt @@ -252,7 +252,6 @@ object Scaffold : Module("Scaffold", Category.WORLD, Keyboard.KEY_I, hideModule // Turn Speed val startRotatingSlow by BoolValue("StartRotatingSlow", false) { rotationMode != "Off" } - val curvePitchRotation by BoolValue("CurvePitchRotation", false) { rotationMode != "Off" } val slowDownOnDirectionChange by BoolValue("SlowDownOnDirectionChange", false) { rotationMode != "Off" } val useStraightLinePath by BoolValue("UseStraightLinePath", true) { rotationMode != "Off" } val maxHorizontalSpeedValue = object : FloatValue("MaxHorizontalSpeed", 180f, 1f..180f) { diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt index b8b17a5d240..7ae90c84652 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/RotationUtils.kt @@ -16,7 +16,6 @@ import net.ccbluex.liquidbounce.utils.misc.RandomUtils.nextFloat import net.minecraft.entity.Entity import net.minecraft.network.play.client.C03PacketPlayer import net.minecraft.util.* -import java.security.SecureRandom import kotlin.math.* object RotationUtils : MinecraftInstance(), Listenable { @@ -186,7 +185,7 @@ object RotationUtils : MinecraftInstance(), Listenable { * @return center */ fun searchCenter( - bb: AxisAlignedBB, outborder: Boolean, random: Boolean, useSpots: Boolean, predict: Boolean, + bb: AxisAlignedBB, outborder: Boolean, random: Boolean, predict: Boolean, lookRange: Float, attackRange: Float, throughWallsRange: Float = 0f, bodyPoints: List = listOf("Head", "Feet"), ): Rotation? { @@ -203,37 +202,25 @@ object RotationUtils : MinecraftInstance(), Listenable { val eyes = mc.thePlayer.eyes - val isInsideEnemy = bb.isVecInside(eyes) - var currRotation = currentRotation ?: mc.thePlayer.rotation var attackRotation: Pair? = null var lookRotation: Pair? = null - if (random && !useSpots) { + if (random) { currRotation += Rotation( if (Math.random() > 0.25) nextFloat(-10f, 10f) else 0f, if (Math.random() > 0.25) nextFloat(-10f, 10f) else 0f ) } - val oldYawDiff = getAngleDifference(serverRotation.yaw, lastServerRotation.yaw) - val yawSign = if (oldYawDiff == 0f) 1f else oldYawDiff.sign - val chanceToRandomize = Math.random() > 0.75 - val threshold = nextFloat(10f, 25f) - val signToFollow = if (Math.random() > 0.5) yawSign else -yawSign - for (x in 0.0..1.0) { for (y in min..max) { for (z in 0.0..1.0) { val vec = bb.lerpWith(x, y, z) val rotation = toRotation(vec, predict).fixedSensitivity() - val yawAngleDiff = getAngleDifference(rotation.yaw, currRotation.yaw) - if (!(!random || !useSpots || chanceToRandomize && getRotationDifference(rotation, currRotation) > threshold && yawAngleDiff.sign == signToFollow)) - continue - // Calculate actual hit vec after applying fixed sensitivity to rotation val gcdVec = bb.calculateIntercept(eyes, eyes + getVectorForRotation(rotation) * lookRange.toDouble() @@ -476,7 +463,7 @@ object RotationUtils : MinecraftInstance(), Listenable { } private fun computeFactor(rotationDifference: Float, turnSpeed: Float): Float { - return (rotationDifference / 180 * turnSpeed).coerceIn(0f, 180f) + return (rotationDifference / nextFloat(120f, 150f) * turnSpeed).coerceIn(0f, 180f) } /**