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

Commit

Permalink
Swing settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Feb 19, 2024
1 parent 10894e1 commit 895aebc
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ 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.CooldownHelper.getAttackCooldownProgress
import net.ccbluex.liquidbounce.utils.CooldownHelper.resetLastAttackedTicks
Expand Down Expand Up @@ -40,10 +41,7 @@ import net.ccbluex.liquidbounce.utils.misc.RandomUtils.nextInt
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawPlatform
import net.ccbluex.liquidbounce.utils.timing.MSTimer
import net.ccbluex.liquidbounce.utils.timing.TimeUtils.randomClickDelay
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.ccbluex.liquidbounce.value.*
import net.minecraft.client.gui.inventory.GuiContainer
import net.minecraft.enchantment.EnchantmentHelper
import net.minecraft.entity.Entity
Expand All @@ -58,6 +56,7 @@ import net.minecraft.network.play.client.C02PacketUseEntity.Action.INTERACT
import net.minecraft.network.play.client.C07PacketPlayerDigging
import net.minecraft.network.play.client.C07PacketPlayerDigging.Action.RELEASE_USE_ITEM
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement
import net.minecraft.network.play.client.C0APacketAnimation
import net.minecraft.potion.Potion
import net.minecraft.util.BlockPos
import net.minecraft.util.EnumFacing
Expand Down Expand Up @@ -133,7 +132,7 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
private val switchDelay by IntegerValue("SwitchDelay", 15, 1..1000) { targetMode == "Switch" }

// Bypass
private val swing by BoolValue("Swing", true)
private val swing by SwingValue()
private val keepSprint by BoolValue("KeepSprint", true)

// AutoBlock
Expand Down Expand Up @@ -247,15 +246,14 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
}

// Bypass
private val failSwing by BoolValue("FailSwing", true) { swing }
private val swingOnlyInAir by BoolValue("SwingOnlyInAir", true) { swing && failSwing }
private val failSwing by BoolValue("FailSwing", true) { swing != "Off" }
private val swingOnlyInAir by BoolValue("SwingOnlyInAir", true) { swing != "Off" && failSwing }
private val noInventoryAttack by BoolValue("NoInvAttack", false, subjective = true)
private val noInventoryDelay by IntegerValue("NoInvDelay", 200, 0..500, subjective = true)
{ noInventoryAttack }
private val noConsumeAttack by ListValue("NoConsumeAttack",
arrayOf("Off", "NoHits", "NoRotation"),
"Off",
subjective = true
)

// Visuals
Expand Down Expand Up @@ -286,6 +284,9 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
var blockStatus = false
private var blockStopInDead = false

// Swing
private var cancelNextSwing = false

/**
* Disable kill aura module
*/
Expand Down Expand Up @@ -427,6 +428,17 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
}
}

/**
* Packet event
*/
@EventTarget
fun onPacket(event: PacketEvent) {
if (event.packet is C0APacketAnimation && cancelNextSwing) {
cancelNextSwing = false
event.cancelEvent()
}
}

/**
* Attack enemy
*/
Expand Down Expand Up @@ -457,7 +469,7 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {

// Check if enemy is not hittable
if (!hittable) {
if (swing && failSwing) {
if (swing != "Off" && failSwing) {
val rotation = currentRotation ?: thePlayer.rotation

runWithModifiedRaycastResult(rotation, range.toDouble(), throughWallsRange.toDouble()) {
Expand All @@ -474,8 +486,12 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
attackEntity(entity)
}
} else {
if (swing == "Visual")
cancelNextSwing = true
// Imitate game click
mc.clickMouse()
if (swing == "Packet")
mc.thePlayer.isSwingInProgress = false
}
attackTickTimes += it to thePlayer.ticksExisted
}
Expand Down Expand Up @@ -669,7 +685,7 @@ object KillAura : Module("KillAura", ModuleCategory.COMBAT) {
callEvent(AttackEvent(entity))

// Attack target
if (swing) thePlayer.swingItem()
mc.thePlayer.swing(swing)

sendPacket(C02PacketUseEntity(entity, ATTACK))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.ver

import net.ccbluex.liquidbounce.event.MoveEvent
import net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.SpeedMode
import net.ccbluex.liquidbounce.utils.ClientUtils
import net.ccbluex.liquidbounce.utils.MovementUtils.isMoving
import net.ccbluex.liquidbounce.utils.MovementUtils.strafe
import net.ccbluex.liquidbounce.utils.extensions.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ import net.ccbluex.liquidbounce.utils.realX
import net.ccbluex.liquidbounce.utils.realY
import net.ccbluex.liquidbounce.utils.realZ
import net.ccbluex.liquidbounce.utils.timing.MSTimer
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.ccbluex.liquidbounce.value.*
import net.minecraft.block.BlockChest
import net.minecraft.block.BlockEnderChest
import net.minecraft.entity.player.EntityPlayer
Expand Down Expand Up @@ -82,7 +79,7 @@ object ChestAura : Module("ChestAura", ModuleCategory.WORLD) {
}
}

private val visualSwing by BoolValue("VisualSwing", true, subjective = true)
private val swing by SwingValue()

private val ignoreLooted by BoolValue("IgnoreLootedChests", true)
private val detectRefill by BoolValue("DetectChestRefill", true)
Expand Down Expand Up @@ -221,8 +218,7 @@ object ChestAura : Module("ChestAura", ModuleCategory.WORLD) {
performRayTrace(entity.pos, vec)?.run {
TickScheduler += {
if (thePlayer.onPlayerRightClick(blockPos, sideHit, hitVec)) {
if (visualSwing) thePlayer.swingItem()
else sendPacket(C0APacketAnimation())
mc.thePlayer.swing(swing)

timer.reset()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ import net.ccbluex.liquidbounce.utils.RotationUtils.limitAngleChange
import net.ccbluex.liquidbounce.utils.RotationUtils.setTargetRotation
import net.ccbluex.liquidbounce.utils.block.BlockUtils.getBlock
import net.ccbluex.liquidbounce.utils.block.BlockUtils.getCenterDistance
import net.ccbluex.liquidbounce.utils.extensions.rotation
import net.ccbluex.liquidbounce.utils.extensions.*
import net.ccbluex.liquidbounce.utils.misc.RandomUtils.nextFloat
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawBlockBox
import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.FloatValue
import net.ccbluex.liquidbounce.value.ListValue
import net.ccbluex.liquidbounce.value.*
import net.minecraft.init.Blocks.air
import net.minecraft.init.Blocks.bedrock
import net.minecraft.network.play.client.C07PacketPlayerDigging
Expand All @@ -33,7 +31,7 @@ import java.awt.Color
object CivBreak : Module("CivBreak", ModuleCategory.WORLD) {

private val range by FloatValue("Range", 5F, 1F..6F)
private val visualSwing by BoolValue("VisualSwing", true, subjective = true)
private val swing by SwingValue()

private val rotations by BoolValue("Rotations", true)
private val strafe by ListValue("Strafe", arrayOf("Off", "Strict", "Silent"), "Off") { rotations }
Expand Down Expand Up @@ -115,11 +113,7 @@ object CivBreak : Module("CivBreak", ModuleCategory.WORLD) {
blockPos ?: return
enumFacing ?: return

if (visualSwing) {
mc.thePlayer.swingItem()
} else {
sendPacket(C0APacketAnimation())
}
mc.thePlayer.swing(swing)

// Break
if (!grim) sendPacket(C07PacketPlayerDigging(START_DESTROY_BLOCK, blockPos, enumFacing))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object Fucker : Module("Fucker", ModuleCategory.WORLD) {
private val instant by BoolValue("Instant", false) { (action == "Destroy" || surroundings) && !hypixel }

private val switch by IntegerValue("SwitchDelay", 250, 0..1000)
private val swing by BoolValue("Swing", true)
private val swing by SwingValue()
private val noHit by BoolValue("NoHit", false)

private val rotations by BoolValue("Rotations", true)
Expand Down Expand Up @@ -210,9 +210,7 @@ object Fucker : Module("Fucker", ModuleCategory.WORLD) {
// CivBreak style block breaking
sendPacket(C07PacketPlayerDigging(START_DESTROY_BLOCK, currentPos, raytrace.sideHit))

if (swing) {
player.swingItem()
}
mc.thePlayer.swing(swing)

sendPacket(C07PacketPlayerDigging(STOP_DESTROY_BLOCK, currentPos, raytrace.sideHit))
currentDamage = 0F
Expand All @@ -231,9 +229,7 @@ object Fucker : Module("Fucker", ModuleCategory.WORLD) {
currentPos
) >= 1f
) {
if (swing) {
player.swingItem()
}
mc.thePlayer.swing(swing)

controller.onPlayerDestroyBlock(currentPos, raytrace.sideHit)

Expand All @@ -244,9 +240,7 @@ object Fucker : Module("Fucker", ModuleCategory.WORLD) {
}
}

if (swing) {
player.swingItem()
}
mc.thePlayer.swing(swing)

currentDamage += block.getPlayerRelativeBlockHardness(player, world, currentPos)
world.sendBlockBreakProgress(player.entityId, currentPos, (currentDamage * 10F).toInt() - 1)
Expand All @@ -264,8 +258,7 @@ object Fucker : Module("Fucker", ModuleCategory.WORLD) {
// Use block
action == "Use" -> {
if (player.onPlayerRightClick(currentPos, raytrace.sideHit, raytrace.hitVec, player.heldItem)) {
if (swing) player.swingItem()
else sendPacket(C0APacketAnimation())
mc.thePlayer.swing(swing)

blockHitDelay = 4
currentDamage = 0F
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ import net.ccbluex.liquidbounce.utils.RotationUtils.setTargetRotation
import net.ccbluex.liquidbounce.utils.block.BlockUtils.getBlock
import net.ccbluex.liquidbounce.utils.block.BlockUtils.getCenterDistance
import net.ccbluex.liquidbounce.utils.block.BlockUtils.searchBlocks
import net.ccbluex.liquidbounce.utils.extensions.eyes
import net.ccbluex.liquidbounce.utils.extensions.*
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawBlockBox
import net.ccbluex.liquidbounce.utils.timing.TickTimer
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.ccbluex.liquidbounce.value.*
import net.minecraft.block.Block
import net.minecraft.block.BlockLiquid
import net.minecraft.init.Blocks.air
Expand All @@ -48,6 +45,8 @@ object Nuker : Module("Nuker", ModuleCategory.WORLD, gameDetecting = false) {
private val throughWalls by BoolValue("ThroughWalls", false)
private val priority by ListValue("Priority", arrayOf("Distance", "Hardness"), "Distance")

private val swing by SwingValue()

private val rotations by BoolValue("Rotations", true)
private val strafe by ListValue("Strafe", arrayOf("Off", "Strict", "Silent"), "Off") { rotations }

Expand Down Expand Up @@ -163,7 +162,7 @@ object Nuker : Module("Nuker", ModuleCategory.WORLD, gameDetecting = false) {
// End block break if able to break instant
if (block.getPlayerRelativeBlockHardness(thePlayer, mc.theWorld, blockPos) >= 1F) {
currentDamage = 0F
thePlayer.swingItem()
mc.thePlayer.swing(swing)
mc.playerController.onPlayerDestroyBlock(blockPos, EnumFacing.DOWN)
blockHitDelay = hitDelay
validBlocks -= blockPos
Expand All @@ -173,7 +172,7 @@ object Nuker : Module("Nuker", ModuleCategory.WORLD, gameDetecting = false) {
}

// Break block
thePlayer.swingItem()
mc.thePlayer.swing(swing)
currentDamage += block.getPlayerRelativeBlockHardness(thePlayer, mc.theWorld, blockPos)
mc.theWorld.sendBlockBreakProgress(thePlayer.entityId, blockPos, (currentDamage * 10F).toInt() - 1)

Expand Down Expand Up @@ -218,7 +217,7 @@ object Nuker : Module("Nuker", ModuleCategory.WORLD, gameDetecting = false) {
.forEach { (pos, _) ->
// Instant break block
sendPacket(C07PacketPlayerDigging(START_DESTROY_BLOCK, pos, EnumFacing.DOWN))
thePlayer.swingItem()
mc.thePlayer.swing(swing)
sendPacket(C07PacketPlayerDigging(STOP_DESTROY_BLOCK, pos, EnumFacing.DOWN))
attackedBlocks += pos
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ import net.ccbluex.liquidbounce.utils.timing.MSTimer
import net.ccbluex.liquidbounce.utils.timing.TickDelayTimer
import net.ccbluex.liquidbounce.utils.timing.TimeUtils.randomClickDelay
import net.ccbluex.liquidbounce.utils.timing.TimeUtils.randomDelay
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.ccbluex.liquidbounce.value.*
import net.minecraft.block.BlockBush
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.client.renderer.GlStateManager.resetColor
Expand Down Expand Up @@ -109,7 +106,7 @@ object Scaffold : Module("Scaffold", ModuleCategory.WORLD) {

// Basic stuff
val sprint by BoolValue("Sprint", false)
private val swing by BoolValue("Swing", true, subjective = true)
private val swing by SwingValue()
private val down by BoolValue("Down", true) { mode !in arrayOf("GodBridge", "Telly") }

private val ticksUntilRotation: IntegerValue = object : IntegerValue("TicksUntilRotation", 3, 1..5) {
Expand Down Expand Up @@ -1210,8 +1207,7 @@ object Scaffold : Module("Scaffold", ModuleCategory.WORLD) {
}
}

if (swing) thePlayer.swingItem()
else sendPacket(C0APacketAnimation())
mc.thePlayer.swing(swing)

if (isManualJumpOptionActive)
blocksPlacedUntilJump++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils
import net.ccbluex.liquidbounce.utils.inventory.InventoryUtils.serverSlot
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawBorderedRect
import net.ccbluex.liquidbounce.utils.timing.TickTimer
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.ccbluex.liquidbounce.value.*
import net.minecraft.block.BlockBush
import net.minecraft.client.gui.ScaledResolution
import net.minecraft.client.renderer.GlStateManager.resetColor
Expand All @@ -58,7 +55,7 @@ object Tower : Module("Tower", ModuleCategory.WORLD, gameDetecting = false) {
"Motion"
)
private val autoBlock by ListValue("AutoBlock", arrayOf("Off", "Pick", "Spoof", "Switch"), "Spoof")
private val swing by BoolValue("Swing", true, subjective = true)
private val swing by SwingValue()
private val stopWhenBlockAbove by BoolValue("StopWhenBlockAbove", false)

private val rotations by BoolValue("Rotations", true)
Expand Down Expand Up @@ -264,8 +261,7 @@ object Tower : Module("Tower", ModuleCategory.WORLD, gameDetecting = false) {

// Place block
if (thePlayer.onPlayerRightClick(placeInfo!!.blockPos, placeInfo!!.enumFacing, placeInfo!!.vec3, itemStack)) {
if (swing) thePlayer.swingItem()
else sendPacket(C0APacketAnimation())
mc.thePlayer.swing(swing)
}

if (autoBlock == "Switch")
Expand Down
Loading

0 comments on commit 895aebc

Please sign in to comment.