Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ void processMovement(Input input, boolean slowDown, float slowDownFactor) {
EventFlow.post(new MovementEvent.InputUpdate(input, slowDown, slowDownFactor));
}

@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSprinting()Z"))
boolean isSprinting(ClientPlayerEntity entity) {
return EventFlow.post(new MovementEvent.Sprint(entity.isSprinting())).getSprint();
}

@Inject(method = "sendMovementPackets", at = @At(value = "HEAD"), cancellable = true)
void sendBegin(CallbackInfo ci) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.lambda.command.commands

import com.lambda.brigadier.CommandResult
import com.lambda.brigadier.argument.string
import com.lambda.brigadier.argument.value
import com.lambda.brigadier.executeWithResult
import com.lambda.brigadier.get
import com.lambda.brigadier.required
import com.lambda.command.CommandManager.register
import com.lambda.command.LambdaCommand
import com.lambda.module.modules.player.Replay
import com.lambda.util.FolderRegister
import com.lambda.util.FolderRegister.listRecursive

object ReplayCommand : LambdaCommand {
override val name = "replay"

init {
register(name, "rep") {
// 1. Save current recording / checkpoint to disc with name
// 2. Load replay from disc with name
// 3. Play replay
// 4. Stop replay
// 5. Pause replay
// 6. Resume replay
// 7. Set replay speed
required(string("replay name")) { replayName ->
suggests { _, builder ->
val dir = FolderRegister.replay
dir.listRecursive().forEach {
builder.suggest(it.relativeTo(dir).path)
}
builder.buildFuture()
}

executeWithResult {
val replayFile = FolderRegister.replay.resolve(this[replayName].value())

if (!replayFile.exists()) {
return@executeWithResult CommandResult.failure("Replay file does not exist")
}

Replay.loadRecording(replayFile)
CommandResult.success()
}
}
}
}
}
12 changes: 6 additions & 6 deletions common/src/main/kotlin/com/lambda/config/Configurable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
range: ClosedRange<Byte>,
step: Byte = 1,
description: String = "",
visibility: () -> Boolean = { true },
unit: String = "",
visibility: () -> Boolean = { true },
) = ByteSetting(name, defaultValue, range, step, description, visibility, unit).also {
settings.add(it)
}
Expand All @@ -267,8 +267,8 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
range: ClosedRange<Double>,
step: Double = 1.0,
description: String = "",
visibility: () -> Boolean = { true },
unit: String = "",
visibility: () -> Boolean = { true },
) = DoubleSetting(name, defaultValue, range, step, description, visibility, unit).also {
settings.add(it)
}
Expand All @@ -292,8 +292,8 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
range: ClosedRange<Float>,
step: Float = 1f,
description: String = "",
visibility: () -> Boolean = { true },
unit: String = "",
visibility: () -> Boolean = { true },
) = FloatSetting(name, defaultValue, range, step, description, visibility, unit).also {
settings.add(it)
}
Expand All @@ -317,8 +317,8 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
range: ClosedRange<Int>,
step: Int = 1,
description: String = "",
visibility: () -> Boolean = { true },
unit: String = "",
visibility: () -> Boolean = { true },
) = IntegerSetting(name, defaultValue, range, step, description, visibility, unit).also {
settings.add(it)
}
Expand All @@ -342,8 +342,8 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
range: ClosedRange<Long>,
step: Long = 1,
description: String = "",
visibility: () -> Boolean = { true },
unit: String = "",
visibility: () -> Boolean = { true },
) = LongSetting(name, defaultValue, range, step, description, visibility, unit).also {
settings.add(it)
}
Expand All @@ -367,8 +367,8 @@ abstract class Configurable(configuration: Configuration) : Jsonable, Nameable {
range: ClosedRange<Short>,
step: Short = 1,
description: String = "",
visibility: () -> Boolean = { true },
unit: String = "",
visibility: () -> Boolean = { true },
) = ShortSetting(name, defaultValue, range, step, description, visibility, unit).also {
settings.add(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class InteractionSettings(
c: Configurable,
vis: () -> Boolean = { true },
) : InteractionConfig {
override val reach by c.setting("Reach", 5.0, 0.1..10.0, 0.1, "Players reach / range", vis)
override val resolution by c.setting("Resolution", 10, 1..100, 1, "Raycast resolution", vis)
override val reach by c.setting("Reach", 5.0, 0.1..10.0, 0.1, "Players reach / range", "", vis)
override val resolution by c.setting("Resolution", 10, 1..100, 1, "Raycast resolution", "", vis)
override val rayCastMask by c.setting("Raycast Mask", RayCastMask.BOTH, "What to raycast against", vis)
}
12 changes: 7 additions & 5 deletions common/src/main/kotlin/com/lambda/config/RotationSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@ package com.lambda.config

import com.lambda.interaction.rotation.IRotationConfig
import com.lambda.interaction.rotation.RotationMode
import kotlin.math.max
import kotlin.math.min
import kotlin.random.Random

class RotationSettings(
c: Configurable,
vis: () -> Boolean = { true },
) : IRotationConfig {
override var rotationMode by c.setting("Mode", RotationMode.SYNC, "SILENT - server-side rotation, SYNC - server-side rotation; client-side movement, LOCK - Lock camera", vis)
override val keepTicks by c.setting("Keep Rotation", 3, 1..10, 1, "Ticks to keep rotation", vis)
override val resetTicks by c.setting("Reset Rotation", 3, 1..10, 1, "Ticks before rotation is reset", vis)
override val keepTicks by c.setting("Keep Rotation", 3, 1..10, 1, "Ticks to keep rotation", "", vis)
override val resetTicks by c.setting("Reset Rotation", 3, 1..10, 1, "Ticks before rotation is reset", "", vis)

private val r1 by c.setting("Turn Speed 1", 70.0, 1.0..180.0, 0.1, "Rotation Speed 1", vis)
private val r2 by c.setting("Turn Speed 2", 110.0, 1.0..180.0, 0.1, "Rotation Speed 2", vis)
var r1 by c.setting("Turn Speed 1", 70.0, 1.0..180.0, 0.1, "Rotation Speed 1", "", vis)
var r2 by c.setting("Turn Speed 2", 110.0, 1.0..180.0, 0.1, "Rotation Speed 2", "", vis)

override val turnSpeed get() = Random.nextDouble(r1, r2)
override val turnSpeed get() = Random.nextDouble(min(r1, r2), max(r1, r2) + 0.01)

var speedMultiplier = 1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ abstract class MovementEvent : Event {

class InputUpdate(
val input: Input,
val slowDown: Boolean,
val slowDownFactor: Float,
var slowDown: Boolean,
var slowDownFactor: Float,
) : MovementEvent()

class Sprint(var sprint: Boolean) : MovementEvent()

class ClipAtLedge(
var clip: Boolean,
) : MovementEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ object GuiSettings : Module(
private val scaleSetting by setting("Scale", 1.0, 0.5..3.0, 0.01, visibility = { page == Page.General })

// Colors
private val primaryColor by setting("Primary Color", Color(130, 200, 255), visibility = { page == Page.Colors })
private val secondaryColor by setting("Secondary Color", Color(225, 130, 225), visibility = { page == Page.Colors && shade })
val primaryColor by setting("Primary Color", Color(130, 200, 255), visibility = { page == Page.Colors })
val secondaryColor by setting("Secondary Color", Color(225, 130, 225), visibility = { page == Page.Colors && shade })
val backgroundColor by setting("Background Color", Color(0, 0, 0, 80), visibility = { page == Page.Colors })
val glow by setting("Glow", true, visibility = { page == Page.Colors })
val shade by setting("Shade Color", true, visibility = { page == Page.Colors })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ object PacketLogger : Module(

onEnableUnsafe {
val fileName = "packet-log-${getTime(fileFormatter)}.txt"

// ToDo: Organize files with FolderRegister.worldBoundDirectory
file = FolderRegister.packetLogs.resolve(fileName).apply {
if (!parentFile.exists()) {
parentFile.mkdirs()
Expand Down
Loading