Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sprint setting in scaffold #4280

Open
wants to merge 4 commits into
base: nextgen
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleFreeCam;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleNoSwing;
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleRotations;
import net.ccbluex.liquidbounce.features.module.modules.world.scaffold.ModuleScaffold;
import net.ccbluex.liquidbounce.features.module.modules.world.scaffold.features.ScaffoldSprintFeature;
import net.ccbluex.liquidbounce.integration.BrowserScreen;
import net.ccbluex.liquidbounce.integration.VrScreen;
import net.ccbluex.liquidbounce.integration.interop.protocol.rest.v1.game.PlayerData;
Expand Down Expand Up @@ -300,6 +302,11 @@ private float hookSprintIgnoreHunger(float constant) {
return ModuleSprint.INSTANCE.shouldIgnoreHunger() ? -1F : constant;
}

@ModifyReturnValue(method = "canSprint", at = @At("RETURN"))
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"))
private boolean hookAutoSprint(boolean original) {
return !ModuleSuperKnockback.INSTANCE.shouldBlockSprinting() && !ModuleKillAura.INSTANCE.shouldBlockSprinting()
Expand Down Expand Up @@ -337,7 +344,15 @@ private boolean hookNoHungerSprint(boolean original) {
return false;
}

return !(ModuleAntiHunger.INSTANCE.getRunning() && ModuleAntiHunger.INSTANCE.getNoSprint()) && original;
if (ScaffoldSprintFeature.INSTANCE.getRunning() && ScaffoldSprintFeature.INSTANCE.getSpoof()) {
return false;
}

if (ModuleAntiHunger.INSTANCE.getRunning() && ModuleAntiHunger.INSTANCE.getNoSprint()) {
return false;
}

return original;
}

@WrapWithCondition(method = "closeScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setScreen(Lnet/minecraft/client/gui/screen/Screen;)V"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ import net.ccbluex.liquidbounce.utils.render.placement.PlacementRenderer
import net.ccbluex.liquidbounce.utils.sorting.ComparatorChain
import net.minecraft.entity.EntityPose
import net.minecraft.item.*
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket.Mode.STOP_SPRINTING
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.Full
import net.minecraft.util.Hand
import net.minecraft.util.hit.BlockHitResult
Expand All @@ -98,6 +100,7 @@ object ModuleScaffold : ClientModule("Scaffold", Category.WORLD) {
private val timer by float("Timer", 1f, 0.01f..10f)

init {
tree(ScaffoldSprintFeature)
tree(ScaffoldAutoBlockFeature)
tree(ScaffoldMovementPrediction)
}
Expand Down Expand Up @@ -501,6 +504,13 @@ object ModuleScaffold : ClientModule("Scaffold", Category.WORLD) {
// Take the fall off position before placing the block
val previousFallOffPos = currentOptimalLine?.let { l -> ScaffoldMovementPrediction.getFallOffPositionOnLine(l) }

if (ScaffoldSprintFeature.UnSprintOnPlace.running && ScaffoldSprintFeature.UnSprintOnPlace.packet) {
if (player.lastSprinting) {
player.networkHandler.sendPacket(ClientCommandC2SPacket(player, STOP_SPRINTING))
player.lastSprinting = false
}
}

renderer.addBlock(target.placedBlock)
doPlacement(currentCrosshairTarget, handToInteractWith, {
ScaffoldMovementPlanner.trackPlacedBlock(target)
Expand All @@ -522,6 +532,7 @@ object ModuleScaffold : ClientModule("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
@@ -0,0 +1,24 @@
package net.ccbluex.liquidbounce.features.module.modules.world.scaffold.features

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

object ScaffoldSprintFeature : ToggleableConfigurable(ModuleScaffold, "Sprint", true) {
val spoof by boolean("Spoof", false)
object UnSprintOnPlace : ToggleableConfigurable(ScaffoldSprintFeature, "UnSprintOnPlace", false) {
val packet by boolean("Packet", false)
}

init {
tree(UnSprintOnPlace)
}

var hasPlacedThisTick = false

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

fun canSprint() = !ModuleScaffold.running || running
&& (!UnSprintOnPlace.enabled || UnSprintOnPlace.packet || !hasPlacedThisTick)
}
Loading