diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinClientPlayerEntity.java b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinClientPlayerEntity.java index 46586f9d2a8..14e2a37a2cb 100644 --- a/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinClientPlayerEntity.java +++ b/src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinClientPlayerEntity.java @@ -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; @@ -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() @@ -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")) diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/ModuleScaffold.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/ModuleScaffold.kt index 6534af1967b..b5248a7efd6 100644 --- a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/ModuleScaffold.kt +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/ModuleScaffold.kt @@ -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 @@ -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) } @@ -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) @@ -522,6 +532,7 @@ object ModuleScaffold : ClientModule("Scaffold", Category.WORLD) { ScaffoldMovementPrediction.onPlace(currentOptimalLine, previousFallOffPos) ScaffoldEagleFeature.onBlockPlacement() ScaffoldBlinkFeature.onBlockPlacement() + ScaffoldSprintFeature.hasPlacedThisTick = true waitTicks(currentDelay) } diff --git a/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/features/ScaffoldSprintFeature.kt b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/features/ScaffoldSprintFeature.kt new file mode 100644 index 00000000000..9c12f100245 --- /dev/null +++ b/src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/features/ScaffoldSprintFeature.kt @@ -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) +}