Skip to content

Commit af1b01f

Browse files
committed
activeRotation over serverRotation for renders, and removed excess interpolation causing it to feel slower than vanilla
1 parent 1b253dd commit af1b01f

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

common/src/main/kotlin/com/lambda/config/groups/RotationSettings.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package com.lambda.config.groups
1919

2020
import com.lambda.config.Configurable
21-
import com.lambda.event.events.TickEvent
2221
import com.lambda.interaction.request.Priority
2322
import com.lambda.interaction.request.rotating.RotationConfig
2423
import com.lambda.interaction.request.rotating.RotationMode
@@ -42,11 +41,6 @@ class RotationSettings(
4241
/** How many ticks to wait before resetting the rotation */
4342
override val decayTicks by c.setting("Reset Rotation", 1, 1..10, 1, "Ticks before rotation is reset", " ticks") { rotate && vis() }
4443

45-
/**
46-
* At what sub-tick stages rotations can be performed
47-
*/
48-
override val rotationStageMask by c.setting("Rotation Stage Mask", setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Player.Post), "The sub-tick stages at which rotations can be performed", visibility = vis)
49-
5044
/** Whether the rotation is instant */
5145
var instant by c.setting("Instant Rotation", true, "Instantly rotate") { rotate && vis() }
5246

common/src/main/kotlin/com/lambda/interaction/request/rotating/RotationConfig.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
package com.lambda.interaction.request.rotating
1919

20-
import com.lambda.event.Event
21-
import com.lambda.event.events.TickEvent
2220
import com.lambda.interaction.request.Priority
2321
import com.lambda.interaction.request.RequestConfig
2422

@@ -51,11 +49,6 @@ abstract class RotationConfig(priority: Priority) : RequestConfig<RotationReques
5149
*/
5250
abstract val decayTicks: Int
5351

54-
/**
55-
* The sub-tick stages at which rotations can take place
56-
*/
57-
abstract val rotationStageMask: Set<Event>
58-
5952
val rotate: Boolean get() = rotationMode != RotationMode.None
6053

6154
override fun requestInternal(request: RotationRequest, queueIfClosed: Boolean) {
@@ -66,7 +59,6 @@ abstract class RotationConfig(priority: Priority) : RequestConfig<RotationReques
6659
override val turnSpeed get() = 360.0
6760
override val keepTicks get() = 1
6861
override val decayTicks get() = 1
69-
override val rotationStageMask = setOf(TickEvent.Pre, TickEvent.Input.Pre, TickEvent.Player.Post)
7062
override val rotationMode = mode
7163
}
7264
}

common/src/main/kotlin/com/lambda/interaction/request/rotating/RotationManager.kt

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import com.lambda.interaction.request.rotating.visibilty.lookAt
3636
import com.lambda.module.modules.client.Baritone
3737
import com.lambda.threading.runGameScheduled
3838
import com.lambda.threading.runSafe
39-
import com.lambda.util.extension.partialTicks
4039
import com.lambda.util.extension.rotation
4140
import com.lambda.util.math.MathUtils.toRadian
4241
import com.lambda.util.math.Vec2d
@@ -135,8 +134,8 @@ object RotationManager : RequestHandler<RotationRequest>(
135134

136135
// Handle LOCK mode
137136
if (activeRequest?.mode == RotationMode.Lock) {
138-
mc.player?.yaw = serverRotation.yawF
139-
mc.player?.pitch = serverRotation.pitchF
137+
mc.player?.yaw = activeRotation.yawF
138+
mc.player?.pitch = activeRotation.pitchF
140139
}
141140
}
142141

@@ -161,34 +160,30 @@ object RotationManager : RequestHandler<RotationRequest>(
161160
activeRequest = null
162161
}
163162

164-
private val smoothRotation
165-
get() =
166-
lerp(mc.partialTicks, prevServerRotation, serverRotation)
167-
168163
@JvmStatic
169164
val lockRotation
170165
get() =
171-
if (activeRequest?.mode == RotationMode.Lock) smoothRotation else null
166+
if (activeRequest?.mode == RotationMode.Lock) activeRotation else null
172167

173168
@JvmStatic
174169
val renderYaw
175170
get() =
176-
if (activeRequest == null) null else smoothRotation.yaw.toFloat()
171+
if (activeRequest == null) null else activeRotation.yaw.toFloat()
177172

178173
@JvmStatic
179174
val renderPitch
180175
get() =
181-
if (activeRequest == null) null else smoothRotation.pitch.toFloat()
176+
if (activeRequest == null) null else activeRotation.pitch.toFloat()
182177

183178
@JvmStatic
184179
val handYaw
185180
get() =
186-
if (activeRequest?.mode == RotationMode.Lock) serverRotation.yaw.toFloat() else null
181+
if (activeRequest?.mode == RotationMode.Lock) activeRotation.yaw.toFloat() else null
187182

188183
@JvmStatic
189184
val handPitch
190185
get() =
191-
if (activeRequest?.mode == RotationMode.Lock) serverRotation.pitch.toFloat() else null
186+
if (activeRequest?.mode == RotationMode.Lock) activeRotation.pitch.toFloat() else null
192187

193188
@JvmStatic
194189
val movementYaw: Float?

0 commit comments

Comments
 (0)