Skip to content

Commit a4d5ed1

Browse files
committed
use rotation requests in pitch 40
1 parent a682c69 commit a4d5ed1

File tree

1 file changed

+23
-18
lines changed
  • src/main/kotlin/com/lambda/module/modules/movement

1 file changed

+23
-18
lines changed

src/main/kotlin/com/lambda/module/modules/movement/Pitch40.kt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
package com.lambda.module.modules.movement
1919

20+
import com.lambda.config.AutomationConfig.Companion.setDefaultAutomationConfig
21+
import com.lambda.config.applyEdits
2022
import com.lambda.event.events.TickEvent
2123
import com.lambda.event.listener.SafeListener.Companion.listen
24+
import com.lambda.interaction.managers.rotating.Rotation
25+
import com.lambda.interaction.managers.rotating.visibilty.lookAt
2226
import com.lambda.module.Module
2327
import com.lambda.module.tag.ModuleTag
2428
import com.lambda.util.Communication.info
@@ -27,48 +31,49 @@ import net.minecraft.client.network.ClientPlayerEntity
2731
import net.minecraft.text.Text.literal
2832
import net.minecraft.util.math.Vec3d
2933

30-
31-
/*
32-
* @author IceTank
33-
* @since 07.12.2025
34-
*/
3534
object Pitch40 : Module(
3635
name = "Pitch40",
3736
description = "Allows you to fly forever",
3837
tag = ModuleTag.MOVEMENT
3938
) {
4039
val logHeightGain by setting("Log Height Gain", true, "Logs the height gained each cycle to the chat")
4140

42-
val PitchUpDefault = -49f // Start angle when going back up. negative pitch = looking up
43-
val PitchDownDefault = 33f // Best angle for getting speed
44-
val PitchAngleChangeSpeed = 0.5f
45-
val PitchUpSpeedThreshold = 45f
41+
const val PITCH_UP_DEFAULT = -49f // Start angle when going back up. negative pitch = looking up
42+
const val PITCH_DOWN_DEFAULT = 33f // Best angle for getting speed
43+
const val PITCH_ANGLE_CHANGE_SPEED = 0.5f
44+
const val PITCH_UP_SPEED_THRESHOLD = 45f
4645

4746
var state = Pitch40State.GainSpeed
48-
var lastAngle = PitchUpDefault
47+
var lastAngle = PITCH_UP_DEFAULT
4948

50-
var lastPos = Vec3d.ZERO
49+
var lastPos: Vec3d = Vec3d.ZERO
5150
var lastY = 0.0
5251

5352
init {
53+
setDefaultAutomationConfig {
54+
applyEdits {
55+
hideAllGroupsExcept(rotationConfig)
56+
}
57+
}
58+
5459
listen<TickEvent.Pre> {
5560
when (state) {
5661
Pitch40State.GainSpeed -> {
57-
player.pitch = PitchDownDefault
58-
if (player.flySpeed() > PitchUpSpeedThreshold) {
62+
lookAt(Rotation(player.yaw, PITCH_DOWN_DEFAULT)).requestBy(this@Pitch40)
63+
if (player.flySpeed() > PITCH_UP_SPEED_THRESHOLD) {
5964
state = Pitch40State.PitchUp
6065
}
6166
}
6267
Pitch40State.PitchUp -> {
6368
lastAngle -= 5f
64-
player.pitch = lastAngle
65-
if (lastAngle <= PitchUpDefault) {
69+
lookAt(Rotation(player.yaw, lastAngle)).requestBy(this@Pitch40)
70+
if (lastAngle <= PITCH_UP_DEFAULT) {
6671
state = Pitch40State.FlyUp
6772
}
6873
}
6974
Pitch40State.FlyUp -> {
70-
lastAngle += PitchAngleChangeSpeed
71-
player.pitch = lastAngle
75+
lastAngle += PITCH_ANGLE_CHANGE_SPEED
76+
lookAt(Rotation(player.yaw, lastAngle)).requestBy(this@Pitch40)
7277
if (lastAngle >= 0f) {
7378
state = Pitch40State.GainSpeed
7479
if (logHeightGain)
@@ -84,7 +89,7 @@ object Pitch40 : Module(
8489
onEnable {
8590
state = Pitch40State.GainSpeed
8691
lastPos = player.pos
87-
lastAngle = PitchUpDefault
92+
lastAngle = PITCH_UP_DEFAULT
8893
}
8994
}
9095

0 commit comments

Comments
 (0)