@@ -55,6 +55,7 @@ object RotationManager : RequestHandler<RotationRequest>(
5555) {
5656 var activeRotation = Rotation .ZERO
5757 var serverRotation = Rotation .ZERO
58+ @JvmStatic
5859 var prevServerRotation = Rotation .ZERO
5960
6061 var activeRequest: RotationRequest ? = null
@@ -155,34 +156,35 @@ object RotationManager : RequestHandler<RotationRequest>(
155156 var pressRight = false
156157
157158 // Determine which 45-degree sector the angle falls into and set the corresponding keys.
158- if (angle > - boundary && angle <= boundary) {
159- // Forward
160- pressForward = true
161- } else if (angle > boundary && angle <= boundary + sector) {
162- // Forward-Left
163- pressForward = true
164- pressLeft = true
165- } else if (angle > boundary + sector && angle <= boundary + 2 * sector) {
166- // Left
167- pressLeft = true
168- } else if (angle > boundary + 2 * sector && angle <= boundary + 3 * sector) {
169- // Backward-Left
170- pressBackward = true
171- pressLeft = true
172- } else if (angle > boundary + 3 * sector || angle <= - (boundary + 3 * sector)) {
173- // Backward
174- pressBackward = true
175- } else if (angle > - (boundary + 3 * sector) && angle <= - (boundary + 2 * sector)) {
176- // Backward-Right
177- pressBackward = true
178- pressRight = true
179- } else if (angle > - (boundary + 2 * sector) && angle <= - (boundary + sector)) {
180- // Right
181- pressRight = true
182- } else if (angle > - (boundary + sector) && angle <= - boundary) {
183- // Forward-Right
184- pressForward = true
185- pressRight = true
159+ when {
160+ angle > - boundary && angle <= boundary -> {
161+ pressForward = true
162+ }
163+ angle > boundary && angle <= boundary + sector -> {
164+ pressForward = true
165+ pressLeft = true
166+ }
167+ angle > boundary + sector && angle <= boundary + 2 * sector -> {
168+ pressLeft = true
169+ }
170+ angle > boundary + 2 * sector && angle <= boundary + 3 * sector -> {
171+ pressBackward = true
172+ pressLeft = true
173+ }
174+ angle > boundary + 3 * sector || angle <= - (boundary + 3 * sector) -> {
175+ pressBackward = true
176+ }
177+ angle > - (boundary + 3 * sector) && angle <= - (boundary + 2 * sector) -> {
178+ pressBackward = true
179+ pressRight = true
180+ }
181+ angle > - (boundary + 2 * sector) && angle <= - (boundary + sector) -> {
182+ pressRight = true
183+ }
184+ angle > - (boundary + sector) && angle <= - boundary -> {
185+ pressForward = true
186+ pressRight = true
187+ }
186188 }
187189
188190 input.playerInput = PlayerInput (
@@ -205,7 +207,7 @@ object RotationManager : RequestHandler<RotationRequest>(
205207
206208 fun onRotationSend () {
207209 prevServerRotation = serverRotation
208- serverRotation = activeRotation/* .fixSensitivity(prevServerRotation) */
210+ serverRotation = activeRotation
209211
210212 if (activeRequest?.rotationMode == RotationMode .Lock ) {
211213 mc.player?.yaw = serverRotation.yawF
0 commit comments