Skip to content

Commit

Permalink
LEGACY: Fixed Scaffold AutoF5 & Blink Nofall (CCBlueX#2846)
Browse files Browse the repository at this point in the history
* LEGACY: Fixed Scaffold AutoF5 & Blink Nofall

- Scaffold now should not reset thirdpersonview when AutoF5 not enabled.
- Changed HypixelBlink  -> Blink
  • Loading branch information
EclipsesDev committed Apr 18, 2024
1 parent 967dd86 commit 6affd0e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import net.ccbluex.liquidbounce.features.module.modules.player.nofallmodes.aac.A
import net.ccbluex.liquidbounce.features.module.modules.player.nofallmodes.aac.AAC3315
import net.ccbluex.liquidbounce.features.module.modules.player.nofallmodes.aac.LAAC
import net.ccbluex.liquidbounce.features.module.modules.player.nofallmodes.other.*
import net.ccbluex.liquidbounce.features.module.modules.player.nofallmodes.other.Blink
import net.ccbluex.liquidbounce.features.module.modules.render.FreeCam
import net.ccbluex.liquidbounce.utils.block.BlockUtils.collideBlock
import net.ccbluex.liquidbounce.value.BoolValue
Expand All @@ -36,7 +37,7 @@ object NoFall : Module("NoFall", ModuleCategory.PLAYER) {
Spartan,
CubeCraft,
Hypixel,
HypixelBlink
Blink
)

private val modes = noFallModes.map { it.modeName }.toTypedArray()
Expand All @@ -46,18 +47,21 @@ object NoFall : Module("NoFall", ModuleCategory.PLAYER) {
val minFallDistance by FloatValue("MinMLGHeight", 5f, 2f..50f, subjective = true) { mode == "MLG" }
val retrieveDelay by IntegerValue("RetrieveDelay", 100, 100..500, subjective = true) { mode == "MLG" }

// Using too many times of simulatePlayer could result timer flag. Hence, why this is disabled by default.
val checkFallDist by BoolValue("CheckFallDistance", false, subjective = true)

val minFallDist: FloatValue = object : FloatValue("MinFallDistance", 2.5f, 0f..10f, subjective = true) {
override fun isSupported() = mode == "HypixelBlink"
override fun isSupported() = mode == "Blink" && checkFallDist
override fun onChange(oldValue: Float, newValue: Float) = newValue.coerceAtMost(maxFallDist.get())
}
val maxFallDist: FloatValue = object : FloatValue("MaxFallDistance", 20f, 0f..100f, subjective = true) {
override fun isSupported() = mode == "HypixelBlink"
override fun isSupported() = mode == "Blink" && checkFallDist
override fun onChange(oldValue: Float, newValue: Float) = newValue.coerceAtLeast(minFallDist.get())
}

val autoOff by BoolValue("AutoOff", true) { mode == "HypixelBlink" }
val simulateDebug by BoolValue("SimulationDebug", false, subjective = true) { mode == "HypixelBlink" }
val fakePlayer by BoolValue("FakePlayer", true, subjective = true) { mode == "HypixelBlink" }
val autoOff by BoolValue("AutoOff", true) { mode == "Blink" }
val simulateDebug by BoolValue("SimulationDebug", false, subjective = true) { mode == "Blink" }
val fakePlayer by BoolValue("FakePlayer", true, subjective = true) { mode == "Blink" }

override fun onEnable() {
modeModule.onEnable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import net.ccbluex.liquidbounce.event.EventTarget
import net.ccbluex.liquidbounce.event.PacketEvent
import net.ccbluex.liquidbounce.event.Render3DEvent
import net.ccbluex.liquidbounce.features.module.modules.player.NoFall.autoOff
import net.ccbluex.liquidbounce.features.module.modules.player.NoFall.checkFallDist
import net.ccbluex.liquidbounce.features.module.modules.player.NoFall.fakePlayer
import net.ccbluex.liquidbounce.features.module.modules.player.NoFall.maxFallDist
import net.ccbluex.liquidbounce.features.module.modules.player.NoFall.minFallDist
Expand All @@ -14,13 +15,14 @@ import net.ccbluex.liquidbounce.injection.implementations.IMixinEntity
import net.ccbluex.liquidbounce.script.api.global.Chat
import net.ccbluex.liquidbounce.utils.BlinkUtils
import net.ccbluex.liquidbounce.utils.SimulatedPlayer
import net.ccbluex.liquidbounce.utils.misc.FallingPlayer
import net.ccbluex.liquidbounce.utils.render.RenderUtils.drawBacktrackBox
import net.ccbluex.liquidbounce.utils.timing.TickTimer
import net.minecraft.network.play.client.C03PacketPlayer
import net.minecraft.util.AxisAlignedBB
import java.awt.Color

object HypixelBlink : NoFallMode("HypixelBlink") {
object Blink : NoFallMode("Blink") {
private var blinked = false

private val tick = TickTimer()
Expand All @@ -40,15 +42,13 @@ object HypixelBlink : NoFallMode("HypixelBlink") {

val simPlayer = SimulatedPlayer.fromClientPlayer(thePlayer.movementInput)

repeat(6) {
simPlayer.tick()
}
simPlayer.tick()

if (simPlayer.onGround && blinked) {
if (thePlayer.onGround) {
tick.update()

if (tick.hasTimePassed(150)) {
if (tick.hasTimePassed(100)) {
BlinkUtils.unblink()
blinked = false
Chat.print("Unblink")
Expand Down Expand Up @@ -76,26 +76,39 @@ object HypixelBlink : NoFallMode("HypixelBlink") {
}
}

// Re-check #1
repeat(2) {
simPlayer.tick()
}

if (simPlayer.isOnLadder() || simPlayer.inWater || simPlayer.isInLava() || simPlayer.isInWeb || simPlayer.isCollided)
return

if (thePlayer.motionY > 0 && blinked)
return

// Re-check
repeat(4) {
simPlayer.tick()
if (simPlayer.onGround)
return

// Re-check #2
if (checkFallDist) {
repeat(6) {
simPlayer.tick()
}
}

if (!simPlayer.onGround && simPlayer.fallDistance > minFallDist.get()) {
val fallingPlayer = FallingPlayer(thePlayer)

if ((checkFallDist && simPlayer.fallDistance > minFallDist.get()) ||
!checkFallDist && fallingPlayer.findCollision(60) != null && simPlayer.motionY < 0) {
if (thePlayer.onGround && !blinked) {
blinked = true

if (fakePlayer)
BlinkUtils.addFakePlayer()

Chat.print("Blinked")
BlinkUtils.blink(packet, event, sent = true, receive = true)
BlinkUtils.blink(packet, event)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,10 @@ object Scaffold : Module("Scaffold", ModuleCategory.WORLD, Keyboard.KEY_I) {
mc.gameSettings.keyBindLeft.pressed = false
}

mc.gameSettings.thirdPersonView = 0
if (autoF5) {
mc.gameSettings.thirdPersonView = 0
}

lockRotation = null
placeRotation = null
mc.timer.timerSpeed = 1f
Expand Down

0 comments on commit 6affd0e

Please sign in to comment.