Skip to content

Commit

Permalink
fix: intave velocity jump chance (CCBlueX#4207)
Browse files Browse the repository at this point in the history
  • Loading branch information
larryngton2 authored Oct 24, 2024
1 parent 4000098 commit f998fb1
Showing 1 changed file with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ package net.ccbluex.liquidbounce.features.module.modules.combat.velocity.mode
import net.ccbluex.liquidbounce.config.Choice
import net.ccbluex.liquidbounce.config.ChoiceConfigurable
import net.ccbluex.liquidbounce.config.ToggleableConfigurable
import net.ccbluex.liquidbounce.event.*
import net.ccbluex.liquidbounce.event.events.*
import net.ccbluex.liquidbounce.event.Listenable
import net.ccbluex.liquidbounce.event.events.AttackEvent
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.event.repeatable
import net.ccbluex.liquidbounce.features.module.modules.combat.velocity.ModuleVelocity.modes
import net.minecraft.client.gui.screen.ingame.InventoryScreen

object VelocityIntave : Choice("Intave") {
override val parent: ChoiceConfigurable<Choice>
get() = modes

private class ReduceOnAttack(parent: Listenable?) : ToggleableConfigurable(parent, "ReduceOnAttack",
true) {

private class ReduceOnAttack(parent: Listenable?) : ToggleableConfigurable(
parent, "ReduceOnAttack",
true
) {
private val reduceFactor by float("Factor", 0.6f, 0.6f..1f)
private val hurtTime by int("HurtTime", 9, 1..10)
var lastAttackTime = 0L
Expand All @@ -42,29 +48,31 @@ object VelocityIntave : Choice("Intave") {
}
lastAttackTime = System.currentTimeMillis()
}

}

init {
tree(ReduceOnAttack(this))
}

override val parent: ChoiceConfigurable<Choice>
get() = modes
private class JumpReset(parent: Listenable?) : ToggleableConfigurable(
parent, "JumpReset",
true
) {

private var intaveTick = 0
private var intaveDamageTick = 0
private val chance by float("Chance", 50f, 0f..100f, "%")

@Suppress("unused")
private val repeatable = repeatable {
intaveTick++
@Suppress("unused")
private val repeatable = repeatable {
val shouldJump = Math.random() * 100 < chance && player.hurtTime > 0
val canJump = player.isOnGround && mc.currentScreen !is InventoryScreen

if (player.hurtTime == 2) {
intaveDamageTick++
if (player.isOnGround && intaveTick % 2 == 0 && intaveDamageTick <= 10) {
if (shouldJump && canJump) {
player.jump()
intaveTick = 0
}
}
}

init {
tree(JumpReset(this))
}
}

0 comments on commit f998fb1

Please sign in to comment.