Skip to content

Commit

Permalink
fix: drop noslow & sword noslow not working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
opZywl committed Nov 23, 2024
1 parent 28e6216 commit 75a4e5a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.utils.RotationUtils.angleDifference
import net.ccbluex.liquidbounce.utils.RotationUtils.serverRotation
import net.ccbluex.liquidbounce.utils.RotationUtils.toRotation
import net.ccbluex.liquidbounce.utils.extensions.center
import net.ccbluex.liquidbounce.utils.extensions.getFullName
import net.ccbluex.liquidbounce.utils.extensions.hitBox
import net.ccbluex.liquidbounce.utils.extensions.isMoving
import net.ccbluex.liquidbounce.utils.extensions.*
import net.ccbluex.liquidbounce.utils.render.ColorUtils.stripColor
import net.ccbluex.liquidbounce.value.*
import net.minecraft.entity.EntityLivingBase
Expand Down Expand Up @@ -115,7 +112,7 @@ object AntiBot : Module("AntiBot", Category.CLIENT, hideModule = false) {
if (health && (entity.health > 20F || entity.health < 0F))
return true

if (entityID && (entity.entityId >= 1000000000 || entity.entityId <= -1))
if (entityID && (entity.entityId >= 1000000000 || entity.entityId <= 0))
return true

if (derp && (entity.rotationPitch > 90F || entity.rotationPitch < -90F))
Expand All @@ -135,10 +132,7 @@ object AntiBot : Module("AntiBot", Category.CLIENT, hideModule = false) {
}

if (ping) {
if (mc.netHandler.getPlayerInfo(entity.uniqueID)?.responseTime == 0 ||
mc.netHandler.getPlayerInfo(entity.uniqueID)?.responseTime == null
)
return true
if (entity.getPing() == 0) return true
}

if (invalidUUID && mc.netHandler.getPlayerInfo(entity.uniqueID) == null) {
Expand All @@ -159,6 +153,12 @@ object AntiBot : Module("AntiBot", Category.CLIENT, hideModule = false) {
if (invalidGround && invalidGroundList.getOrDefault(entity.entityId, 0) >= 10)
return true

if (alwaysInRadius && entity.entityId !in notAlwaysInRadiusList)
return true

if (alwaysBehind && entity.entityId in alwaysBehindList)
return true

if (duplicateProfile) {
return mc.netHandler.playerInfoMap.count {
it.gameProfile.name == entity.gameProfile.name
Expand Down Expand Up @@ -213,12 +213,6 @@ object AntiBot : Module("AntiBot", Category.CLIENT, hideModule = false) {
return !shouldReturn
}

if (alwaysInRadius && entity.entityId !in notAlwaysInRadiusList)
return true

if (alwaysBehind && entity.entityId in alwaysBehindList)
return true

return entity.name.isEmpty() || entity.name == mc.thePlayer.name
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura
import net.ccbluex.liquidbounce.utils.BlinkUtils
import net.ccbluex.liquidbounce.utils.MovementUtils.hasMotion
import net.ccbluex.liquidbounce.utils.PacketUtils.sendPacket
import net.ccbluex.liquidbounce.utils.SilentHotbar
import net.ccbluex.liquidbounce.utils.chat
import net.ccbluex.liquidbounce.utils.extensions.isMoving
import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils
import net.ccbluex.liquidbounce.utils.timing.TickTimer
Expand Down Expand Up @@ -97,13 +99,15 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
val heldItem = player.heldItem ?: return
val isUsingItem = usingItemFunc()

if (mc.thePlayer.motionX == 0.0 && mc.thePlayer.motionZ == 0.0 && !shouldSwap)
return

if (!consumeFoodOnly && heldItem.item is ItemFood || !consumeDrinkOnly && (heldItem.item is ItemPotion || heldItem.item is ItemBucketMilk))
if (!hasMotion && !shouldSwap)
return

if (isUsingItem || shouldSwap) {
if (heldItem.item !is ItemSword && !consumeFoodOnly && heldItem.item is ItemFood ||
!consumeDrinkOnly && (heldItem.item is ItemPotion || heldItem.item is ItemBucketMilk)) {
return
}

when (consumeMode.lowercase()) {
"aac5" ->
sendPacket(C08PacketPlayerBlockPlacement(BlockPos(-1, -1, -1), 255, heldItem, 0f, 0f, 0f))
Expand Down Expand Up @@ -134,8 +138,6 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
sendPacket(C07PacketPlayerDigging(RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.UP))
}
}

else -> return
}
}

Expand Down Expand Up @@ -164,15 +166,11 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
}
}
}

else -> return
}
}

if (heldItem.item is ItemSword && isUsingItem) {
when (swordMode.lowercase()) {
"none" -> return

"ncp" ->
when (event.eventState) {
EventState.PRE -> sendPacket(
Expand Down Expand Up @@ -203,6 +201,7 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
"switchitem" ->
if (event.eventState == EventState.PRE) {
updateSlot()
chat("work")
}

"invalidc08" -> {
Expand All @@ -226,9 +225,12 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
return

// Credit: @ManInMyVan
// TODO: Not sure how to fix random grim simulation flag.
// TODO: Not sure how to fix random grim simulation flag. (Seem to only happen in Loyisa).
if (consumeMode == "Drop") {
if (player.heldItem?.item !is ItemFood) return
if (player.heldItem?.item !is ItemFood) {
shouldNoSlow = false
return
}

val isUsingItem = packet is C08PacketPlayerBlockPlacement && packet.placedBlockDirection == 255

Expand Down Expand Up @@ -321,11 +323,17 @@ object NoSlow : Module("NoSlow", Category.MOVEMENT, gameDetecting = false, hideM
fun onSlowDown(event: SlowDownEvent) {
val heldItem = mc.thePlayer.heldItem?.item

if (!consumeFoodOnly && heldItem is ItemFood || !consumeDrinkOnly && (heldItem is ItemPotion || heldItem is ItemBucketMilk))
return
if (heldItem !is ItemSword) {
if (!consumeFoodOnly && heldItem is ItemFood ||
!consumeDrinkOnly && (heldItem is ItemPotion || heldItem is ItemBucketMilk)
) {
return
}

if (consumeMode == "Drop" && !shouldNoSlow)
return
}

if (consumeMode == "Drop" && !shouldNoSlow && heldItem is ItemFood)
return
event.forward = getMultiplier(heldItem, true)
event.strafe = getMultiplier(heldItem, false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,11 @@ object NameTags : Module("NameTags", Category.VISUAL, hideModule = false) {

if (armor && entity is EntityPlayer) {
for (index in 0..4) {
if (entity.getEquipmentInSlot(index) == null) {
continue
}
val itemStack = entity.getEquipmentInSlot(index) ?: continue

mc.renderItem.zLevel = -147F
mc.renderItem.renderItemAndEffectIntoGUI(
entity.getEquipmentInSlot(index), -50 + index * 20, if (potion && foundPotion) -42 else -22
itemStack, -50 + index * 20, if (potion && foundPotion) -42 else -22
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import net.ccbluex.liquidbounce.ui.client.hud.element.Border
import net.ccbluex.liquidbounce.ui.client.hud.element.Element
import net.ccbluex.liquidbounce.ui.client.hud.element.ElementInfo
import net.ccbluex.liquidbounce.ui.client.hud.element.Side
import net.ccbluex.liquidbounce.ui.font.AWTFontRenderer.Companion.assumeNonVolatile
import net.ccbluex.liquidbounce.ui.font.Fonts
import net.ccbluex.liquidbounce.utils.*
import net.ccbluex.liquidbounce.utils.MovementUtils.speed
Expand Down Expand Up @@ -260,6 +261,8 @@ class Text(x: Double = 10.0, y: Double = 10.0, scale: Float = 1F, side: Side = S
val shouldRender = showBlock && stack != null && stack.item is ItemBlock
val showBlockScale = if (shouldRender) 1.2F else 1F

assumeNonVolatile = true

if ((Scaffold.handleEvents() && onScaffold) || !onScaffold) {
val rainbow = textColorMode == "Rainbow"
val gradient = textColorMode == "Gradient"
Expand Down Expand Up @@ -361,6 +364,8 @@ class Text(x: Double = 10.0, y: Double = 10.0, scale: Float = 1F, side: Side = S
updateElement()
}

assumeNonVolatile = false

return Border(
((-2F - if (shouldRender) 6F else 0F) * (1F + backgroundScale)) * (showBlockScale * 1.15F),
(-2F * (1F + backgroundScale)) * showBlockScale,
Expand Down

0 comments on commit 75a4e5a

Please sign in to comment.