Skip to content

Commit

Permalink
fix(legacy): duplicated rotation settings in Scaffold (#5377)
Browse files Browse the repository at this point in the history
  • Loading branch information
MukjepScarlet authored Jan 20, 2025
1 parent fce980f commit 11d29e6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 31 deletions.
4 changes: 3 additions & 1 deletion src/main/java/net/ccbluex/liquidbounce/LiquidBounce.kt
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ object LiquidBounce {
isStarting = false

if (!FileManager.firstStart && FileManager.backedup) {
MiscUtils.showMessageDialog("Warning: backup triggered", "Client update detected! Please check the config folder.")
SharedScopes.IO.launch {
MiscUtils.showMessageDialog("Warning: backup triggered", "Client update detected! Please check the config folder.")
}
}

EventManager.call(StartupEvent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ object NoRotateSet : Module("NoRotateSet", Category.MISC, gameDetecting = false)
val affectRotation by boolean("AffectRotation", true)

private val ticksUntilStart = intRange("TicksUntilStart", 0..0, 0..20) { affectRotation }

private val options = RotationSettings(this) { affectRotation }.apply {
withoutKeepRotation()
rotationsValue.excludeWithState(true)
applyServerSideValue.excludeWithState(true)
resetTicksValue.excludeWithState(1)

withoutKeepRotation()
}

fun shouldModify(player: EntityPlayer) = handleEvents() && (!ignoreOnSpawn || player.ticksExisted != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,7 @@ object Scaffold : Module("Scaffold", Category.WORLD, Keyboard.KEY_I) {
// Extra clicks
private val extraClicks by boolean("DoExtraClicks", false)
private val simulateDoubleClicking by boolean("SimulateDoubleClicking", false) { extraClicks }
private val extraClickMaxCPSValue: Value<Int> = int("ExtraClickMaxCPS", 7, 0..50) {
extraClicks
}.onChange { _, new ->
new.coerceAtLeast(extraClickMinCPS)
}
private val extraClickMaxCPS by extraClickMaxCPSValue

private val extraClickMinCPS by int("ExtraClickMinCPS", 3, 0..50) {
extraClicks
}.onChange { _, new ->
new.coerceAtMost(extraClickMaxCPS)
}

private val extraClickCPS by intRange("ExtraClickCPS", 3..7, 0..50) { extraClicks }
private val placementAttempt by choices(
"PlacementAttempt", arrayOf("Fail", "Independent"), "Fail"
) { extraClicks }
Expand Down Expand Up @@ -253,7 +241,7 @@ object Scaffold : Module("Scaffold", Category.WORLD, Keyboard.KEY_I) {
get() = RotationUtils.currentRotation ?: mc.thePlayer.rotation

// Extra clicks
private var extraClick = ExtraClickInfo(TimeUtils.randomClickDelay(extraClickMinCPS, extraClickMaxCPS), 0L, 0)
private var extraClick = ExtraClickInfo(TimeUtils.randomClickDelay(extraClickCPS.first, extraClickCPS.last), 0L, 0)

// GodBridge
private var blocksPlacedUntilJump = 0
Expand Down Expand Up @@ -811,7 +799,7 @@ object Scaffold : Module("Scaffold", Category.WORLD, Keyboard.KEY_I) {

if (raytrace.typeOfHit.isBlock && timePassed) {
extraClick = ExtraClickInfo(
TimeUtils.randomClickDelay(extraClickMinCPS, extraClickMaxCPS),
TimeUtils.randomClickDelay(extraClickCPS.first, extraClickCPS.last),
System.currentTimeMillis(),
extraClick.clicks + 1
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ open class RotationSettings(owner: Module, generalApply: () -> Boolean = { true
open val strictValue = boolean("Strict", false) { strafeValue.isActive() && generalApply() }
open val keepRotationValue = boolean("KeepRotation", true) { rotationsActive && applyServerSide && generalApply() }

open val resetTicksValue: Value<Int> = int("ResetTicks", 1, 1..20) {
open val resetTicksValue = int("ResetTicks", 1, 1..20) {
rotationsActive && applyServerSide && keepRotation && generalApply()
}.onChange { _, new ->
new.coerceAtLeast(1) // minimum
}

open val legitimizeValue = boolean("Legitimize", false) { rotationsActive && generalApply() }
Expand All @@ -41,8 +39,6 @@ open class RotationSettings(owner: Module, generalApply: () -> Boolean = { true

open val angleResetDifferenceValue = float("AngleResetDifference", 5f.withGCD(), 0.0f..180f) {
rotationsActive && applyServerSide && generalApply()
}.onChange { _, new ->
new.withGCD().coerceIn(0.0f..180f) // range
}

open val minRotationDifferenceValue = float(
Expand Down Expand Up @@ -82,10 +78,8 @@ open class RotationSettings(owner: Module, generalApply: () -> Boolean = { true
val verticalSpeed
get() = verticalAngleChange.random()

fun withoutKeepRotation(): RotationSettings {
fun withoutKeepRotation() = apply {
keepRotationValue.excludeWithState()

return this
}

fun updateSimulateShortStopData(diff: Float) {
Expand Down Expand Up @@ -122,12 +116,8 @@ class RotationSettingsWithRotationModes(

val rotationModeValue = listValue.setSupport { generalApply() }

val rotationMode by rotationModeValue
val rotationMode by +rotationModeValue

override val rotationsActive: Boolean
get() = rotationMode != "Off"

init {
owner.addValues(this.values)
}
}

0 comments on commit 11d29e6

Please sign in to comment.