Skip to content

Commit 8a5fef6

Browse files
committed
Freecam sprint
1 parent e5d627e commit 8a5fef6

File tree

1 file changed

+5
-2
lines changed
  • common/src/main/kotlin/com/lambda/module/modules/player

1 file changed

+5
-2
lines changed

common/src/main/kotlin/com/lambda/module/modules/player/Freecam.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.lambda.util.primitives.extension.rotation
2121
import com.lambda.util.world.raycast.RayCastMask
2222
import com.lambda.util.world.raycast.RayCastUtils.rayCast
2323
import net.minecraft.client.input.KeyboardInput
24+
import net.minecraft.client.option.KeyBinding
2425
import net.minecraft.entity.Entity
2526
import net.minecraft.util.math.Vec3d
2627
import kotlin.math.pow
@@ -31,7 +32,8 @@ object Freecam : Module(
3132
defaultTags = setOf(ModuleTag.RENDER),
3233
defaultKeybind = KeyCode.G
3334
) {
34-
private val speed by setting("Speed", 0.5, 0.1..1.0, 0.1)
35+
private val speed by setting("Speed", 0.5f, 0.1f..1.0f, 0.1f)
36+
private val sprint by setting("Sprint Multiplier", 3.0f, 0.1f..10.0f, 0.1f, description = "Set below 1.0 to fly slower on sprint.")
3537
private val rotateToTarget by setting("Rotate to target", true)
3638

3739
private val rotationConfig = RotationSettings(this).apply {
@@ -91,7 +93,8 @@ object Freecam : Module(
9193
if (input.jumping) y++
9294
if (input.sneaking) y--
9395
val inputVec = Vec3d(input.movementSideways.toDouble(), y, input.movementForward.toDouble())
94-
val velocityDelta = Entity.movementInputToVelocity(inputVec, speed.toFloat(), rotation.yaw.toFloat())
96+
val endSpeed = speed * if (mc.options.sprintKey.isPressed) sprint else 1.0f
97+
val velocityDelta = Entity.movementInputToVelocity(inputVec, endSpeed, rotation.yawF)
9598

9699
// move freecam
97100
velocity = velocity.add(velocityDelta).multiply(0.6)

0 commit comments

Comments
 (0)