Skip to content

Commit

Permalink
UnSprintOnPlace setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Nov 23, 2024
1 parent c1a8102 commit 9f0ca64
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ private float hookSprintIgnoreHunger(float constant) {
}

@ModifyReturnValue(method = "canSprint", at = @At("RETURN"))
private boolean injectScaffoldSprintValue(boolean original) {
return original && (!ModuleScaffold.INSTANCE.handleEvents() || ScaffoldSprintFeature.INSTANCE.handleEvents());
private boolean hookScaffoldSprint(boolean original) {
return original && ScaffoldSprintFeature.INSTANCE.canSprint();
}

@ModifyExpressionValue(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;isPressed()Z"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ object ModuleScaffold : Module("Scaffold", Category.WORLD) {
ScaffoldMovementPrediction.onPlace(currentOptimalLine, previousFallOffPos)
ScaffoldEagleFeature.onBlockPlacement()
ScaffoldBlinkFeature.onBlockPlacement()
ScaffoldSprintFeature.hasPlacedThisTick = true

waitTicks(currentDelay)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
package net.ccbluex.liquidbounce.features.module.modules.world.scaffold.features

import net.ccbluex.liquidbounce.config.ToggleableConfigurable
import net.ccbluex.liquidbounce.event.repeatable
import net.ccbluex.liquidbounce.features.module.modules.world.scaffold.ModuleScaffold

object ScaffoldSprintFeature : ToggleableConfigurable(ModuleScaffold, "Sprint", true) {
val spoof by boolean("Spoof", false)
private val unSprintOnPlace by boolean("UnSprintOnPlace", false)

var hasPlacedThisTick = false

@Suppress("unused")
private val tickHandler = repeatable { hasPlacedThisTick = false }

fun canSprint() = !ModuleScaffold.handleEvents() || handleEvents() && (!unSprintOnPlace || !hasPlacedThisTick)
}

0 comments on commit 9f0ca64

Please sign in to comment.