Skip to content

Commit

Permalink
RecodeKillAura Completed!
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed Mar 10, 2024
1 parent 3ba058d commit c551d18
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.aspw.client.features.module.impl.combat

import net.aspw.client.Launch
import net.aspw.client.event.EventTarget
import net.aspw.client.event.Render3DEvent
import net.aspw.client.event.UpdateEvent
import net.aspw.client.event.WorldEvent
import net.aspw.client.features.module.Module
Expand All @@ -10,15 +11,16 @@ import net.aspw.client.features.module.ModuleInfo
import net.aspw.client.features.module.impl.player.Freecam
import net.aspw.client.features.module.impl.player.LegitScaffold
import net.aspw.client.features.module.impl.player.Scaffold
import net.aspw.client.utils.CooldownHelper
import net.aspw.client.utils.EntityUtils
import net.aspw.client.utils.RotationUtils
import net.aspw.client.utils.timer.MSTimer
import net.aspw.client.utils.timer.TimeUtils
import net.aspw.client.value.BoolValue
import net.aspw.client.value.FloatValue
import net.aspw.client.value.IntegerValue
import net.aspw.client.value.ListValue
import net.minecraft.client.settings.KeyBinding
import net.minecraft.entity.EntityLivingBase
import net.minecraft.item.ItemSword


@ModuleInfo(
Expand All @@ -27,7 +29,21 @@ import net.minecraft.entity.EntityLivingBase
)
class KillAuraRecode : Module() {

private val cpsValue = ListValue("CPSMode", arrayOf("Low", "Normal", "High"), "Normal")
private val coolDownCheck = BoolValue("Cooldown-Check", false)
private val maxCPS: IntegerValue = object : IntegerValue("MaxCPS", 12, 1, 20, { !coolDownCheck.get() }) {
override fun onChanged(oldValue: Int, newValue: Int) {
val i = minCPS.get()
if (i > newValue) set(i)
delay = TimeUtils.randomClickDelay(minCPS.get(), this.get())
}
}
private val minCPS: IntegerValue = object : IntegerValue("MinCPS", 10, 1, 20, { !coolDownCheck.get() }) {
override fun onChanged(oldValue: Int, newValue: Int) {
val i = maxCPS.get()
if (i < newValue) set(i)
delay = TimeUtils.randomClickDelay(this.get(), maxCPS.get())
}
}

private val maxTurnSpeed: FloatValue = object : FloatValue("MaxTurnSpeed", 80f, 0f, 180f, "°") {
override fun onChanged(oldValue: Float, newValue: Float) {
Expand All @@ -51,63 +67,49 @@ class KillAuraRecode : Module() {
private val realAutoBlock = BoolValue("RealAutoBlock", false)
private val autoBlockDelay = IntegerValue("AutoBlockTick", 5, 1, 20) { realAutoBlock.get() }

private var thread: Thread? = null
private val clickTimer = MSTimer()
private var lastTarget: EntityLivingBase? = null
private val match = when (cpsValue.get().lowercase()) {
"low" -> 8
"normal" -> 12
"high" -> 20
else -> 0
}
private val attackDelay: Long get() = 1000L / match.toLong()
private var delay = if (coolDownCheck.get()) TimeUtils.randomClickDelay(20, 20) else TimeUtils.randomClickDelay(
minCPS.get(),
maxCPS.get()
)
private var lastSwing = 0L
private var blockTick = 0
var isBlocking = false
var isTargeting = false

override fun onDisable() {
isBlocking = false
isTargeting = false
clickTimer.reset()
blockTick = 0
lastSwing = 0L
lastTarget = null
}

@EventTarget
fun onWorld(event: WorldEvent) {
state = false
chat("LegitAura was disabled")
chat("KillAuraRecode was disabled")
}

@EventTarget
fun onUpdate(event: UpdateEvent) {
if (Launch.moduleManager[Freecam::class.java]!!.state || Launch.moduleManager[Scaffold::class.java]!!.state || Launch.moduleManager[LegitScaffold::class.java]!!.state) {
if (mc.thePlayer == null || mc.theWorld == null || Launch.moduleManager[Freecam::class.java]!!.state || Launch.moduleManager[Scaffold::class.java]!!.state || Launch.moduleManager[LegitScaffold::class.java]!!.state) return

if (lastTarget != null && mc.thePlayer.canEntityBeSeen(lastTarget))
RotationUtils.faceLook(lastTarget!!, minTurnSpeed.get(), maxTurnSpeed.get())
}

@EventTarget
fun onRender(event: Render3DEvent) {
if (mc.thePlayer == null || mc.theWorld == null || Launch.moduleManager[Freecam::class.java]!!.state || Launch.moduleManager[Scaffold::class.java]!!.state || Launch.moduleManager[LegitScaffold::class.java]!!.state) {
isBlocking = false
isTargeting = false
clickTimer.reset()
blockTick = 0
lastSwing = 0L
lastTarget = null
return
}

if (lastTarget != null)
RotationUtils.faceLook(lastTarget!!, minTurnSpeed.get(), maxTurnSpeed.get())

if (!clickTimer.hasTimePassed(attackDelay)) return

try {
if (thread == null || !thread!!.isAlive) {
thread = Thread { runAttack() }
thread!!.start()
clickTimer.reset()
} else clickTimer.reset()
} catch (_: Exception) {
}
}

private fun runAttack() {
if (mc.thePlayer == null || mc.theWorld == null) return

val targets = arrayListOf<EntityLivingBase>()
var entityCount = 0

Expand All @@ -134,29 +136,36 @@ class KillAuraRecode : Module() {
lastTarget = null
isBlocking = false
isTargeting = false
lastSwing = 0L
blockTick = 0
return
}

targets.sortBy { it.health }

targets.forEach {
if (mc.thePlayer == null || mc.theWorld == null) return

lastTarget = it

if (!mc.thePlayer.canEntityBeSeen(lastTarget)) return

if (mc.thePlayer.getDistanceToEntity(lastTarget) <= (if (modifiedReach.get()) rangeValue.get() - 0.6f else 3.4f)) {
if (coolDownCheck.get() && CooldownHelper.getAttackCooldownProgress() < 1f) return

if (mc.thePlayer.getDistanceToEntity(lastTarget) <= (if (modifiedReach.get()) rangeValue.get() - 0.6f else 3.4f) && System.currentTimeMillis() - lastSwing >= delay) {
KeyBinding.onTick(mc.gameSettings.keyBindAttack.keyCode)

if (realAutoBlock.get()) {
blockTick += 1
if (blockTick >= autoBlockDelay.get()) {
KeyBinding.onTick(mc.gameSettings.keyBindUseItem.keyCode)
if (mc.thePlayer.heldItem != null && mc.thePlayer.heldItem.item is ItemSword)
KeyBinding.onTick(mc.gameSettings.keyBindUseItem.keyCode)
blockTick = 0
}
}

lastSwing = System.currentTimeMillis()
delay = if (coolDownCheck.get())
TimeUtils.randomClickDelay(20, 20)
else TimeUtils.randomClickDelay(minCPS.get(), maxCPS.get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class TriggerBot : Module() {
else TimeUtils.randomClickDelay(minCPS.get(), maxCPS.get())
private var lastSwing = 0L

override fun onDisable() {
lastSwing = 0L
}

@EventTarget
fun onRender(event: Render3DEvent) {
if (coolDownCheck.get() && CooldownHelper.getAttackCooldownProgress() < 1f)
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/client.forge.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"network.MixinNetworkManager_5",
"network.MixinNetworkPlayerInfo",
"network.MixinServerData",
"network.MixinServerPinger",
"packets.MixinC00Handshake",
"render.MixinEntityRenderer",
"render.MixinFontRenderer",
Expand Down

0 comments on commit c551d18

Please sign in to comment.