Skip to content

Commit

Permalink
UnSprintOnPlace Packet setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Nov 23, 2024
1 parent 9f0ca64 commit 9cb291b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
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 Down Expand Up @@ -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 }),
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 9cb291b

Please sign in to comment.