Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
Merge 43ab08b
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Feb 21, 2024
1 parent 232bc2d commit ba6d03f
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.modules.player.Reach
import net.ccbluex.liquidbounce.utils.EntityUtils.isSelected
import net.ccbluex.liquidbounce.utils.RotationUtils.getCenter
import net.ccbluex.liquidbounce.utils.RotationUtils.getRotationDifference
import net.ccbluex.liquidbounce.utils.RotationUtils.isFaced
import net.ccbluex.liquidbounce.utils.RotationUtils.limitAngleChange
import net.ccbluex.liquidbounce.utils.RotationUtils.searchCenter
import net.ccbluex.liquidbounce.utils.RotationUtils.toRotation
import net.ccbluex.liquidbounce.utils.SimulatedPlayer
import net.ccbluex.liquidbounce.utils.extensions.*
import net.ccbluex.liquidbounce.utils.timing.MSTimer
import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.FloatValue
import net.ccbluex.liquidbounce.value.*
import net.minecraft.entity.Entity
import net.minecraft.util.Vec3
import java.util.*

object AimBot : Module("AimBot", ModuleCategory.COMBAT) {

private val range by FloatValue("Range", 4.4F, 1F..8F)
private val turnSpeed by FloatValue("TurnSpeed", 10f, 1F..180F)
private val inViewTurnSpeed by FloatValue("InViewTurnSpeed", 35f, 1f..180f)
private val predictClientMovement by IntegerValue("PredictClientMovement", 2, 0..5)
private val predictEnemyPosition by FloatValue("PredictEnemyPosition", 1.5f, -1f..2f)
private val fov by FloatValue("FOV", 180F, 1F..180F)
private val center by BoolValue("Center", false)
private val lock by BoolValue("Lock", true)
Expand Down Expand Up @@ -94,30 +94,42 @@ object AimBot : Module("AimBot", ModuleCategory.COMBAT) {
}

private fun findRotation(entity: Entity, random: Random): Boolean {
val thePlayer = mc.thePlayer ?: return false

val entityPrediction = Vec3(entity.posX - entity.prevPosX,
entity.posY - entity.prevPosY,
entity.posZ - entity.prevPosZ
).times(1.5)

// Look up required rotations to hit enemy
val boundingBox = entity.hitBox.offset(
entityPrediction.xCoord,
entityPrediction.yCoord,
entityPrediction.zCoord
)

val playerRotation = thePlayer.rotation
val destinationRotation =
if (center) toRotation(getCenter(boundingBox), true)
else searchCenter(boundingBox,
val player = mc.thePlayer ?: return false

val (predictX, predictY, predictZ) = entity.currPos.subtract(entity.prevPos)
.times(2 + predictEnemyPosition.toDouble())

val boundingBox = entity.hitBox.offset(predictX, predictY, predictZ)
val (currPos, oldPos) = player.currPos to player.prevPos

val simPlayer = SimulatedPlayer.fromClientPlayer(player.movementInput)

repeat(predictClientMovement + 1) {
simPlayer.tick()
}

player.setPosAndPrevPos(simPlayer.pos)

val playerRotation = player.rotation

val destinationRotation = if (center) {
toRotation(boundingBox.center, true)
} else {
searchCenter(boundingBox,
outborder = false,
random = false,
gaussianOffset = false,
predict = true,
lookRange = range,
attackRange = if (Reach.handleEvents()) Reach.combatReach else 3f
) ?: return false
)
}

if (destinationRotation == null) {
player.setPosAndPrevPos(currPos, oldPos)

return false
}

// Figure out the best turn speed suitable for the distance and configured turn speed
val rotationDiff = getRotationDifference(playerRotation, destinationRotation)
Expand All @@ -132,9 +144,11 @@ object AimBot : Module("AimBot", ModuleCategory.COMBAT) {
val gaussian = random.nextGaussian()

val realisticTurnSpeed = rotationDiff * ((supposedTurnSpeed + (gaussian - 0.5)) / 180)
val rotation = limitAngleChange(thePlayer.rotation, destinationRotation, realisticTurnSpeed.toFloat())
val rotation = limitAngleChange(player.rotation, destinationRotation, realisticTurnSpeed.toFloat())

rotation.toPlayer(player)

rotation.toPlayer(thePlayer)
player.setPosAndPrevPos(currPos, oldPos)

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.modules.render.FreeCam
import net.ccbluex.liquidbounce.features.module.modules.targets.*
import net.ccbluex.liquidbounce.features.module.modules.targets.AntiBot.isBot
import net.ccbluex.liquidbounce.features.module.modules.world.ChestAura
import net.ccbluex.liquidbounce.utils.CPSCounter
import net.ccbluex.liquidbounce.utils.*
import net.ccbluex.liquidbounce.utils.CooldownHelper.getAttackCooldownProgress
import net.ccbluex.liquidbounce.utils.CooldownHelper.resetLastAttackedTicks
import net.ccbluex.liquidbounce.utils.MovementUtils.isMoving
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPacket
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPackets
import net.ccbluex.liquidbounce.utils.RaycastUtils.raycastEntity
import net.ccbluex.liquidbounce.utils.RaycastUtils.runWithModifiedRaycastResult
import net.ccbluex.liquidbounce.utils.Rotation
import net.ccbluex.liquidbounce.utils.RotationUtils.currentRotation
import net.ccbluex.liquidbounce.utils.RotationUtils.getCenter
import net.ccbluex.liquidbounce.utils.RotationUtils.getRotationDifference
import net.ccbluex.liquidbounce.utils.RotationUtils.getVectorForRotation
import net.ccbluex.liquidbounce.utils.RotationUtils.isRotationFaced
Expand Down Expand Up @@ -61,7 +58,6 @@ import net.minecraft.potion.Potion
import net.minecraft.util.BlockPos
import net.minecraft.util.EnumFacing
import net.minecraft.util.MovingObjectPosition
import net.minecraft.util.Vec3
import net.minecraft.world.WorldSettings
import java.awt.Color
import kotlin.math.max
Expand Down Expand Up @@ -228,22 +224,13 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
private val smootherMode by ListValue("SmootherMode", arrayOf("Linear", "Relative"), "Relative")

private val randomCenter by BoolValue("RandomCenter", true)
private val gaussianOffset by BoolValue("GaussianOffset", false) { randomCenter }
private val outborder by BoolValue("Outborder", false)
private val fov by FloatValue("FOV", 180f, 0f..180f)

// Predict
private val predictValue = BoolValue("Predict", true)
private val predict by predictValue
private val maxPredictSizeValue = object : FloatValue("MaxPredictSize", 1f, 0.1f..5f) {
override fun onChange(oldValue: Float, newValue: Float) = newValue.coerceAtLeast(minPredictSize)
override fun isSupported() = predictValue.isActive()
}

private val maxPredictSize by maxPredictSizeValue
private val minPredictSize: Float by object : FloatValue("MinPredictSize", 1f, 0.1f..5f) {
override fun onChange(oldValue: Float, newValue: Float) = newValue.coerceAtMost(maxPredictSize)
override fun isSupported() = predictValue.isActive() && !maxPredictSizeValue.isMinimal()
}
private val predictClientMovement by IntegerValue("PredictClientMovement", 2, 0..5)
private val predictEnemyPosition by FloatValue("PredictEnemyPosition", 1.5f, -1f..2f)

// Bypass
private val failSwing by BoolValue("FailSwing", true) { swing != "Off" }
Expand Down Expand Up @@ -740,40 +727,41 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
* Update killaura rotations to enemy
*/
private fun updateRotations(entity: Entity): Boolean {
val entityPrediction = Vec3(entity.posX - entity.prevPosX,
entity.posY - entity.prevPosY,
entity.posZ - entity.prevPosZ
).times(1.5)

var boundingBox = entity.hitBox.offset(
entityPrediction.xCoord,
entityPrediction.yCoord,
entityPrediction.zCoord
)
val player = mc.thePlayer ?: return false

if (predict) {
boundingBox = boundingBox.offset(
(entity.posX - entity.prevPosX - (mc.thePlayer.posX - mc.thePlayer.prevPosX))
* nextFloat(minPredictSize, maxPredictSize),
(entity.posY - entity.prevPosY - (mc.thePlayer.posY - mc.thePlayer.prevPosY))
* nextFloat(minPredictSize, maxPredictSize),
(entity.posZ - entity.prevPosZ - (mc.thePlayer.posZ - mc.thePlayer.prevPosZ))
* nextFloat(minPredictSize, maxPredictSize)
)
val (predictX, predictY, predictZ) = entity.currPos.subtract(entity.prevPos)
.times(2 + predictEnemyPosition.toDouble())

val boundingBox = entity.hitBox.offset(predictX, predictY, predictZ)
val (currPos, oldPos) = player.currPos to player.prevPos

val simPlayer = SimulatedPlayer.fromClientPlayer(player.movementInput)

repeat(predictClientMovement + 1) {
simPlayer.tick()
}

player.setPosAndPrevPos(simPlayer.pos)

val rotation = searchCenter(
boundingBox,
outborder && !attackTimer.hasTimePassed(attackDelay / 2),
randomCenter,
predict,
gaussianOffset = this.gaussianOffset,
predict = false,
lookRange = range + scanRange,
attackRange = range,
throughWallsRange = throughWallsRange
) ?: return false
)

if (rotation == null) {
player.setPosAndPrevPos(currPos, oldPos)

return false
}

// Get our current rotation. Otherwise, player rotation.
val currentRotation = currentRotation ?: mc.thePlayer.rotation
val currentRotation = currentRotation ?: player.rotation

var limitedRotation = limitAngleChange(currentRotation,
rotation,
Expand Down Expand Up @@ -802,9 +790,11 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
smootherMode
)
} else {
limitedRotation.toPlayer(mc.thePlayer)
limitedRotation.toPlayer(player)
}

player.setPosAndPrevPos(currPos, oldPos)

return true
}

Expand Down Expand Up @@ -1000,7 +990,7 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {

if (mc.thePlayer.hurtTime > maxOwnHurtTime) return false

val rotationToPlayer = toRotation(getCenter(mc.thePlayer.hitBox), true, currentTarget!!)
val rotationToPlayer = toRotation(mc.thePlayer.hitBox.center, true, currentTarget!!)

if (getRotationDifference(rotationToPlayer, currentTarget!!.rotation) > maxDirectionDiff)
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
public class MixinMovementInputFromOptions extends MixinMovementInput {
@Inject(method = "updatePlayerMoveState", at = @At(value = "FIELD", target = "Lnet/minecraft/util/MovementInputFromOptions;jump:Z"))
private void hookSuperKnockbackInputBlock(CallbackInfo ci) {
// Ignore other inputs that update on the same function (SimulatedPlayer for example)
if ((Object) this != Minecraft.getMinecraft().thePlayer.movementInput) {
return;
}

SuperKnockback module = SuperKnockback.INSTANCE;

if (module.shouldBlockInput()) {
Expand Down
Loading

0 comments on commit ba6d03f

Please sign in to comment.