-
-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Yaw Offset can now be used with any speed mode - AutoWalk not triggering Speed (fixes #4766) - The Avoid Edge Bump option is now available as a general switch on [Speed]. It may not apply to every mode, but I think it is easier to understand and change if it applies globally.
- Loading branch information
Showing
22 changed files
with
192 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
.../kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/speed/SpeedYawOffset.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
* | ||
* Copyright (c) 2015 - 2024 CCBlueX | ||
* | ||
* LiquidBounce is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* LiquidBounce is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.ccbluex.liquidbounce.features.module.modules.movement.speed | ||
|
||
import net.ccbluex.liquidbounce.config.types.NamedChoice | ||
import net.ccbluex.liquidbounce.config.types.ToggleableConfigurable | ||
import net.ccbluex.liquidbounce.event.events.GameTickEvent | ||
import net.ccbluex.liquidbounce.event.handler | ||
import net.ccbluex.liquidbounce.utils.aiming.Rotation | ||
import net.ccbluex.liquidbounce.utils.aiming.RotationManager | ||
import net.ccbluex.liquidbounce.utils.aiming.RotationsConfigurable | ||
import net.ccbluex.liquidbounce.utils.kotlin.Priority | ||
|
||
/** | ||
* Makes you go faster by strafing 45deg | ||
*/ | ||
object SpeedYawOffset : ToggleableConfigurable(ModuleSpeed, "YawOffset", false) { | ||
|
||
private val yawOffsetMode by enumChoice("YawOffsetMode", YawOffsetMode.AIR) | ||
private val rotationsConfigurable = RotationsConfigurable(this) | ||
|
||
private var yaw = 0f | ||
|
||
@Suppress("unused") | ||
private val yawOffsetHandler = handler<GameTickEvent> { | ||
when (yawOffsetMode) { | ||
YawOffsetMode.GROUND -> groundYawOffset() // makes you strafe more on ground | ||
YawOffsetMode.AIR -> airYawOffset() // 45deg strafe on air | ||
YawOffsetMode.NONE -> return@handler | ||
} | ||
|
||
val rotation = Rotation(player.yaw - yaw, player.pitch) | ||
|
||
RotationManager.aimAt( | ||
rotationsConfigurable.toAimPlan(rotation), Priority.NOT_IMPORTANT, | ||
ModuleSpeed | ||
) | ||
} | ||
|
||
private fun groundYawOffset(): Float { | ||
yaw = if (player.isOnGround) { | ||
when { | ||
mc.options.forwardKey.isPressed && mc.options.leftKey.isPressed -> 45f | ||
mc.options.forwardKey.isPressed && mc.options.rightKey.isPressed -> -45f | ||
mc.options.backKey.isPressed && mc.options.leftKey.isPressed -> 135f | ||
mc.options.backKey.isPressed && mc.options.rightKey.isPressed -> -135f | ||
mc.options.backKey.isPressed -> 180f | ||
mc.options.leftKey.isPressed -> 90f | ||
mc.options.rightKey.isPressed -> -90f | ||
else -> 0f | ||
} | ||
} else { | ||
0f | ||
} | ||
return 0f | ||
} | ||
|
||
private fun airYawOffset(): Float { | ||
yaw = when { | ||
!player.isOnGround && | ||
mc.options.forwardKey.isPressed && | ||
!mc.options.leftKey.isPressed && | ||
!mc.options.rightKey.isPressed | ||
-> -45f | ||
|
||
else -> 0f | ||
} | ||
return 0f | ||
} | ||
|
||
private enum class YawOffsetMode(override val choiceName: String) : NamedChoice { | ||
GROUND("Ground"), | ||
AIR("Air"), | ||
NONE("None") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.