Skip to content

Commit

Permalink
feat(Criticals-Blink): range option (#4701)
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 authored Nov 26, 2024
1 parent 6d0991b commit 65c2272
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ object ModuleCriticals : ClientModule("Criticals", Category.COMBAT) {
&& world.findEnemy(0.0f..enemyInRange) != null

val stopSprinting by enumChoice("StopSprinting", StopSprintingMode.LEGIT)
private val enemyInRange by float("Range", 3.0f, 0.0f..10.0f)
private val enemyInRange by float("Range", 4.0f, 0.0f..10.0f)

@Suppress("unused")
private val attackHandler = handler<AttackEntityEvent>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ package net.ccbluex.liquidbounce.features.module.modules.combat.criticals.modes

import net.ccbluex.liquidbounce.config.types.Choice
import net.ccbluex.liquidbounce.config.types.ChoiceConfigurable
import net.ccbluex.liquidbounce.event.events.GameTickEvent
import net.ccbluex.liquidbounce.event.events.QueuePacketEvent
import net.ccbluex.liquidbounce.event.events.TransferOrigin
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.features.module.modules.combat.criticals.ModuleCriticals
import net.ccbluex.liquidbounce.features.module.modules.combat.criticals.ModuleCriticals.wouldDoCriticalHit
import net.ccbluex.liquidbounce.utils.client.PacketQueueManager
import net.ccbluex.liquidbounce.utils.combat.findEnemy
import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket
import net.minecraft.network.packet.c2s.play.*

Expand All @@ -35,13 +37,20 @@ object CriticalsBlink : Choice("Blink") {
get() = ModuleCriticals.modes

private val delay by intRange("Delay", 300..600, 0..1000, "ms")
private val range by float("Range", 4.0f, 0.0f..10.0f)
private var nextDelay = delay.random()

var isInState = false
private var enemyInRange = false

@Suppress("unused")
private val tickHandler = handler<GameTickEvent> {
enemyInRange = world.findEnemy(0.0f..range) != null
}

@Suppress("unused")
private val fakeLagHandler = handler<QueuePacketEvent> { event ->
if (event.origin == TransferOrigin.SEND && !wouldDoCriticalHit(ignoreSprint = true)) {
if (event.origin == TransferOrigin.SEND && !wouldDoCriticalHit(ignoreSprint = true) && !enemyInRange) {
if (PacketQueueManager.isAboveTime(nextDelay.toLong())) {
nextDelay = delay.random()
return@handler
Expand Down

0 comments on commit 65c2272

Please sign in to comment.