From 9cb291b9b59e44bbedcfbfc62f5c8d1e1148e95a Mon Sep 17 00:00:00 2001 From: ManInMyVan Date: Fri, 22 Nov 2024 18:53:04 -0700 Subject: [PATCH] UnSprintOnPlace Packet setting --- .../module/modules/world/scaffold/ModuleScaffold.kt | 11 ++++++++++- .../world/scaffold/features/ScaffoldSprintFeature.kt | 11 +++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) 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 e717cf077a59..5fe8864ec60d 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 @@ -118,7 +120,7 @@ object ModuleScaffold : Module("Scaffold", Category.WORLD) { enum class SameYMode( override val choiceName: String, - val getTargetedBlockPos: (BlockPos) -> BlockPos? + val getTargetedBlockPos: (BlockPos) -> BlockPos?, ) : NamedChoice { OFF("Off", { null }), @@ -502,6 +504,13 @@ object ModuleScaffold : Module("Scaffold", Category.WORLD) { // Take the fall off position before placing the block val previousFallOffPos = currentOptimalLine?.let { l -> ScaffoldMovementPrediction.getFallOffPositionOnLine(l) } + if (ScaffoldSprintFeature.UnSprintOnPlace.handleEvents() && 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) 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 index 69c043a9cba6..dea6d2a8e59c 100644 --- 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 @@ -6,12 +6,19 @@ import net.ccbluex.liquidbounce.features.module.modules.world.scaffold.ModuleSca object ScaffoldSprintFeature : ToggleableConfigurable(ModuleScaffold, "Sprint", true) { val spoof by boolean("Spoof", false) - private val unSprintOnPlace by boolean("UnSprintOnPlace", false) + object UnSprintOnPlace : ToggleableConfigurable(ScaffoldSprintFeature, "UnSprintOnPlace", false) { + val packet by boolean("Packet", false) + } + + init { + tree(UnSprintOnPlace) + } var hasPlacedThisTick = false @Suppress("unused") private val tickHandler = repeatable { hasPlacedThisTick = false } - fun canSprint() = !ModuleScaffold.handleEvents() || handleEvents() && (!unSprintOnPlace || !hasPlacedThisTick) + fun canSprint() = !ModuleScaffold.handleEvents() || handleEvents() + && (!UnSprintOnPlace.enabled || UnSprintOnPlace.packet || !hasPlacedThisTick) }