Skip to content

Commit

Permalink
AntiBot Update
Browse files Browse the repository at this point in the history
  • Loading branch information
XeContrast committed Nov 1, 2024
1 parent 74b0a91 commit 018737d
Show file tree
Hide file tree
Showing 11 changed files with 254 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ object KillAura : Module() {
}
"stopmotion" -> {
if (mc.playerController.currentGameType != WorldSettings.GameType.SPECTATOR) {
mc.thePlayer.attackTargetEntityWithCurrentItem(entity)
PlayerUtils.attackTargetEntityWithCurrentItem(entity)
}
}
"stopsprint" -> mc.thePlayer.serverSprintState = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ object NoSlow : Module() {
"WatchDog2",
"UNCP",
"NCP",
"NewMatrix",
"AAC",
"AAC4",
"AAC5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ import net.ccbluex.liquidbounce.script.api.global.Chat
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.NotifyType
import net.ccbluex.liquidbounce.utils.RotationUtils
import net.ccbluex.liquidbounce.utils.isMoving
import net.ccbluex.liquidbounce.utils.render.ColorUtils.stripColor
import net.minecraft.client.network.NetworkPlayerInfo
import net.minecraft.entity.Entity
import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemArmor
import net.minecraft.network.play.server.*
import net.minecraft.potion.Potion
import net.minecraft.world.WorldSettings
import java.util.*
import java.util.concurrent.CopyOnWriteArrayList
import kotlin.math.abs
import kotlin.math.sqrt

@ModuleInfo("AntiBot","Prevents KillAura from attacking AntiCheat bots.", category = ModuleCategory.OTHER)
object AntiBot : Module() {
Expand All @@ -44,6 +47,7 @@ object AntiBot : Module() {
private val groundValue = BoolValue("Ground", true).displayable { modeValue.get() == "Custom"}
private val airValue = BoolValue("Air", false).displayable { modeValue.get() == "Custom"}
private val invalidGroundValue = BoolValue("InvalidGround", true).displayable { modeValue.get() == "Custom"}
private val invalidSpeedValue = BoolValue("InvalidSpeed", true).displayable { modeValue.get() == "Custom"}
private val swingValue = BoolValue("Swing", false).displayable { modeValue.get() == "Custom"}
private val healthValue = BoolValue("Health", false).displayable { modeValue.get() == "Custom"}
private val derpValue = BoolValue("Derp", true).displayable { modeValue.get() == "Custom"}
Expand Down Expand Up @@ -119,6 +123,7 @@ object AntiBot : Module() {
private val duplicate = mutableListOf<UUID>()
private val noClip = mutableListOf<Int>()
private val matrix = mutableListOf<Int>()
private val invalidSpeedList = mutableSetOf<Int>()
private val hasRemovedEntities = mutableListOf<Int>()
private val regex = Regex("\\w{3,16}")
private var wasAdded = mc.thePlayer != null
Expand Down Expand Up @@ -303,6 +308,9 @@ object AntiBot : Module() {
}
}

if (invalidSpeedValue.get() && entity.entityId in invalidSpeedList)
return true

if (pingValue.get()) {
if (mc.netHandler.getPlayerInfo(entity.uniqueID)?.responseTime == 0) {
return true
Expand Down Expand Up @@ -332,9 +340,9 @@ object AntiBot : Module() {
return true
}

if (matrix7.get() && matrix.contains(entity.entityId)) {
return true
}
// if (matrix7.get() && matrix.contains(entity.entityId)) {
// return true
// }

if (duplicateCompareModeValue.equals("WhenSpawn") && duplicate.contains(entity.gameProfile.id)) {
return true
Expand Down Expand Up @@ -429,7 +437,7 @@ object AntiBot : Module() {
}
}

@EventTarget
@EventTarget(ignoreCondition = true)
fun onPacket(event: PacketEvent) {
if (mc.thePlayer == null || mc.theWorld == null) return
val packet = event.packet
Expand All @@ -441,7 +449,20 @@ object AntiBot : Module() {
)

is S14PacketEntity -> {
val entity = packet.getEntity(mc.theWorld)
if (czechHekValue.get()) wasAdded = false
if (invalidSpeedValue.get() && entity is EntityPlayer) {
val deltaX = entity.posX - entity.prevPosX
val deltaZ = entity.posZ - entity.prevPosZ
val speed = sqrt(deltaX * deltaX + deltaZ * deltaZ)


if (speed in 0.45..0.46 && (!entity.isSprinting || !entity.isMoving ||
entity.getActivePotionEffect(Potion.moveSpeed) == null))
{
invalidSpeedList += entity.entityId
}
}
processEntityMove(packet.getEntity(mc.theWorld) ?: return, packet.onGround)
}

Expand Down Expand Up @@ -513,6 +534,14 @@ object AntiBot : Module() {
}

if (matrix7.get() && modeValue.get() == "Custom") {
val world = mc.theWorld ?: return
val player = mc.thePlayer ?: return
world.playerEntities.forEach { entity ->
if (entity != player && entity.customNameTag == "") {
world.removeEntity(entity)
if (debugValue.get()) Chat.alert("AntiBot Remove ${entity.gameProfile.name}")
}
}
// val player = mc.thePlayer ?: return
// val world = mc.theWorld ?: return
// for (entity in world.playerEntities) {
Expand All @@ -522,42 +551,42 @@ object AntiBot : Module() {
// continue
// }
// }
mc.theWorld.playerEntities.forEach { entity ->
if (entity.inventory.armorInventory.all { it != null } && entity.heldItem != null) {

val player = mc.thePlayer ?: return@forEach
val world = mc.theWorld ?: return@forEach
val playerPosY = player.posY - 2..player.posY + 2

if (entity.posY in playerPosY) {

val entityRot = entity.rotationYaw
val playerPreRot = player.prevRotationYaw

val rotDiff = abs(entityRot - playerPreRot)
val utilDiff = abs(entityRot - RotationUtils.serverRotation?.yaw!!)

if ((rotDiff <= 10 || utilDiff <= 10) && !matrix.contains(entity.entityId)) {
// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.")
// world.removeEntityFromWorld(entity.entityId)
matrix.add(entity.entityId)
if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}")
}

if (entity.isSprinting && entity.moveForward == 0f && !matrix.contains(entity.entityId)) {
// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.")
// world.removeEntityFromWorld(entity.entityId)
matrix.add(entity.entityId)
if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}")
}
if (matrix.contains(entity.entityId)) {
if (packet is S38PacketPlayerListItem && packet.action == S38PacketPlayerListItem.Action.REMOVE_PLAYER) {
if (player.getDistanceToEntity(entity) < 10) matrix.remove(entity.entityId)
}
}
}
}
}
// mc.theWorld.playerEntities.forEach { entity ->
// if (entity.inventory.armorInventory.all { it != null } && entity.heldItem != null) {
//
// val player = mc.thePlayer ?: return@forEach
// val world = mc.theWorld ?: return@forEach
// val playerPosY = player.posY - 2..player.posY + 2
//
// if (entity.posY in playerPosY) {
//
// val entityRot = entity.rotationYaw
// val playerPreRot = player.prevRotationYaw
//
// val rotDiff = abs(entityRot - playerPreRot)
// val utilDiff = abs(entityRot - RotationUtils.serverRotation?.yaw!!)
//
// if ((rotDiff <= 10 || utilDiff <= 10) && !matrix.contains(entity.entityId)) {
//// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.")
//// world.removeEntityFromWorld(entity.entityId)
// matrix.add(entity.entityId)
// if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}")
// }
//
// if (entity.isSprinting && entity.moveForward == 0f && !matrix.contains(entity.entityId)) {
//// if (debugValue.get()) Chat.alert("§7[§a§lAnti Bot/§6Matrix§7] §fPrevented §r${entity.gameProfile.name} §ffrom spawning.")
//// world.removeEntityFromWorld(entity.entityId)
// matrix.add(entity.entityId)
// if (debugValue.get()) Chat.alert("AntiBot + ${entity.gameProfile.name}")
// }
// if (matrix.contains(entity.entityId)) {
// if (packet is S38PacketPlayerListItem && packet.action == S38PacketPlayerListItem.Action.REMOVE_PLAYER) {
// if (player.getDistanceToEntity(entity) < 10) matrix.remove(entity.entityId)
// }
// }
// }
// }
// }
}
}

Expand All @@ -577,6 +606,7 @@ object AntiBot : Module() {

private fun clearAll() {
hitted.clear()
invalidSpeedList.clear()
swing.clear()
ground.clear()
invalidGround.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ object AntiSuffocate : Module(){

fun onPreMotion(){

if (mc.thePlayer.isEntityInsideOpaqueBlock()){
if (mc.thePlayer.isEntityInsideOpaqueBlock){
PacketUtils.sendPacketNoEvent(C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, BlockPos(mc.thePlayer).down(), EnumFacing.UP))

if (swing.get()){
mc.thePlayer.swingItem();
mc.thePlayer.swingItem()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ object AntiVoid : Module() {

when (modeValue.get().lowercase()) {
"groundspoof" -> {
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
canSpoof = mc.thePlayer.fallDistance > maxFallDistValue.get()
}
}
Expand All @@ -152,7 +152,7 @@ object AntiVoid : Module() {

val pearl = InventoryUtils.findItem(36, 45, Items.ender_pearl)
if (mc.thePlayer.fallDistance > maxFallDistValue.get() && (pearl - 36) > -1) {
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
mc.thePlayer.inventory.currentItem = pearl - 36
}
}
Expand All @@ -171,7 +171,7 @@ object AntiVoid : Module() {
posY = mc.thePlayer.prevPosY
posZ = mc.thePlayer.prevPosZ
}
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) {
mc.thePlayer.setPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ)
mc.netHandler.addToSendQueue(
Expand Down Expand Up @@ -199,7 +199,7 @@ object AntiVoid : Module() {
}

"motionflag" -> {
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) {
mc.thePlayer.motionY += motionflagValue.get()
mc.thePlayer.fallDistance = 0.0F
Expand All @@ -209,7 +209,7 @@ object AntiVoid : Module() {
}

"packetflag" -> {
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) {
mc.netHandler.addToSendQueue(
C03PacketPlayer.C04PacketPlayerPosition(
Expand Down Expand Up @@ -237,7 +237,7 @@ object AntiVoid : Module() {
posY = mc.thePlayer.prevPosY
posZ = mc.thePlayer.prevPosZ
}
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (mc.thePlayer.fallDistance > maxFallDistValue.get() && !tried) {
mc.thePlayer.setPositionAndUpdate(posX, posY, posZ)
mc.thePlayer.fallDistance = 0F
Expand All @@ -251,7 +251,7 @@ object AntiVoid : Module() {

"jartex" -> {
canSpoof = false
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (mc.thePlayer.fallDistance > maxFallDistValue.get() && mc.thePlayer.posY < lastRecY + 0.01 && mc.thePlayer.motionY <= 0 && !mc.thePlayer.onGround && !flagged) {
mc.thePlayer.motionY = 0.0
mc.thePlayer.motionZ *= 0.838
Expand All @@ -264,7 +264,7 @@ object AntiVoid : Module() {

"oldcubecraft" -> {
canSpoof = false
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (mc.thePlayer.fallDistance > maxFallDistValue.get() && mc.thePlayer.posY < lastRecY + 0.01 && mc.thePlayer.motionY <= 0 && !mc.thePlayer.onGround && !flagged) {
mc.thePlayer.motionY = 0.0
mc.thePlayer.motionZ = 0.0
Expand All @@ -288,7 +288,7 @@ object AntiVoid : Module() {
}

"packet" -> {
if (checkVoid()) {
if (checkVoid) {
canCancel = true
}

Expand Down Expand Up @@ -355,8 +355,14 @@ object AntiVoid : Module() {
}
}

private fun checkVoid(): Boolean {
return (FallingPlayer(mc.thePlayer ?: return false).findCollision(60) == null)
val checkVoid: Boolean
get() {
for (i in 0..128) {
if (MovementUtils.isOnGround(i.toDouble())) {
return false
}
}
return true
}

@EventTarget
Expand All @@ -366,7 +372,7 @@ object AntiVoid : Module() {
if (mc.currentScreen != null || mc.playerController.currentGameType == WorldSettings.GameType.SPECTATOR
|| mc.playerController.currentGameType == WorldSettings.GameType.CREATIVE
) return
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (player.fallDistance > maxFallDistValue.get()) {
if (player.heldItem?.item is ItemEnderPearl && player.heldItem.item != null) {
if (freezeValue.equals("Cancel")) {
Expand Down Expand Up @@ -404,7 +410,7 @@ object AntiVoid : Module() {
val player = mc.thePlayer ?: return
if (mc.currentScreen != null || mc.playerController.currentGameType == WorldSettings.GameType.SPECTATOR
|| mc.playerController.currentGameType == WorldSettings.GameType.CREATIVE) return
if (!voidOnlyValue.get() || checkVoid()) {
if (!voidOnlyValue.get() || checkVoid) {
if (player.fallDistance > maxFallDistValue.get()) {
if (freezeValue.equals("Cancel")) {
if (player.heldItem?.item is ItemEnderPearl) {
Expand Down Expand Up @@ -466,7 +472,7 @@ object AntiVoid : Module() {
3.125f

if (packet is C03PacketPlayer) {
if (voidOnlyValue.get() && mc.thePlayer.fallDistance >= maxFallDistValue.get() && mc.thePlayer.motionY <= 0 && checkVoid()) {
if (voidOnlyValue.get() && mc.thePlayer.fallDistance >= maxFallDistValue.get() && mc.thePlayer.motionY <= 0 && checkVoid) {
packet.y += 11.0
}
if (!voidOnlyValue.get() && mc.thePlayer.fallDistance >= maxFallDistValue.get()) packet.y += 11.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ object InvManager : Module() {
is ItemBlock -> return !InventoryUtils.isBlockListBlock(item) && amount[1] <= maxblock.get()
is ItemPotion -> return isUsefulPotion(itemStack)
is ItemBoat,is ItemMinecart -> return ignoreVehiclesValue.get()
is ItemFishingRod -> return amount[4] < 1
is ItemBed, is ItemEnderPearl,is ItemBucket -> return true
}

Expand Down
Loading

0 comments on commit 018737d

Please sign in to comment.