From 11d29e698ef614637a5451a3a89276b7cca5f014 Mon Sep 17 00:00:00 2001 From: MukjepScarlet <93977077+MukjepScarlet@users.noreply.github.com> Date: Mon, 20 Jan 2025 21:13:11 +0800 Subject: [PATCH] fix(legacy): duplicated rotation settings in Scaffold (#5377) --- .../net/ccbluex/liquidbounce/LiquidBounce.kt | 4 +++- .../module/modules/misc/NoRotateSet.kt | 4 ++-- .../module/modules/world/scaffolds/Scaffold.kt | 18 +++--------------- .../utils/rotation/RotationSettings.kt | 16 +++------------- 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/main/java/net/ccbluex/liquidbounce/LiquidBounce.kt b/src/main/java/net/ccbluex/liquidbounce/LiquidBounce.kt index 0a2364c876b..81cbd856935 100644 --- a/src/main/java/net/ccbluex/liquidbounce/LiquidBounce.kt +++ b/src/main/java/net/ccbluex/liquidbounce/LiquidBounce.kt @@ -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) diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/NoRotateSet.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/NoRotateSet.kt index e2afc4107e0..ffbf7eaca1f 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/NoRotateSet.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/misc/NoRotateSet.kt @@ -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) diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt index 13456fd4837..21babad8d3f 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/world/scaffolds/Scaffold.kt @@ -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("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 } @@ -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 @@ -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 ) diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationSettings.kt b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationSettings.kt index a7288269c4d..f97d96cda7b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationSettings.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/rotation/RotationSettings.kt @@ -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("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() } @@ -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( @@ -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) { @@ -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) - } } \ No newline at end of file