This repository was archived by the owner on Dec 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathLongJump.kt
More file actions
198 lines (154 loc) · 6.53 KB
/
LongJump.kt
File metadata and controls
198 lines (154 loc) · 6.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
package com.lambda.client.module.modules.movement
import com.lambda.client.commons.interfaces.DisplayEnum
import com.lambda.client.event.events.PacketEvent
import com.lambda.client.event.events.PlayerMoveEvent
import com.lambda.client.module.Category
import com.lambda.client.module.Module
import com.lambda.client.util.BaritoneUtils
import com.lambda.client.util.MovementUtils.applySpeedPotionEffects
import com.lambda.client.util.MovementUtils.calcMoveYaw
import com.lambda.client.util.MovementUtils.isInputting
import com.lambda.client.util.threads.safeListener
import net.minecraft.network.play.server.SPacketPlayerPosLook
import net.minecraftforge.fml.common.gameevent.TickEvent
import kotlin.math.cos
import kotlin.math.hypot
import kotlin.math.sin
/**
* @author Doogie13
* @since 17/03/2023
*/
object LongJump : Module(
name = "LongJump",
description = "Allows you to abuse velocity to jump further",
category = Category.MOVEMENT
) {
private val mode by setting("Mode", Mode.STANDARD, description = "How to boost your motion")
private var speed by setting("Speed", 3.8, 0.0..10.0, 0.001, description = "How much to boost your initial motion")
private val virtue by setting("Glide", false, description = "Glide along the ground after jumping") // extends the boost from LJ. reasonably major 2014 exploit, works on UpdatedNCP in 2023
private val applyPots by setting("Apply Speed Pots", true, description = "Whether to apply Speed potion effect") // sometimes we don't want to due to some arbitrary top speed
enum class Mode(override val displayName: String) : DisplayEnum {
STANDARD("Standard"),
UPDATED("UpdatedNCP")
}
private var currentSpeed = .2873
private var strafePhase = StandardPhase.HEAD_START
private var lastDistance = 0.0
private var jumpTick = 0
init {
onEnable {
strafePhase = StandardPhase.HEAD_START
currentSpeed = .2873
lastDistance = 0.0
jumpTick = 0
}
safeListener<PacketEvent.Receive> {
if (it.packet is SPacketPlayerPosLook) {
currentSpeed = .0
disable()
}
}
safeListener<TickEvent.ClientTickEvent> {
if (it.phase != TickEvent.Phase.START)
return@safeListener
lastDistance = hypot(player.posX - player.lastTickPosX, player.posZ - player.lastTickPosZ)
}
safeListener<PlayerMoveEvent> {
val base = if (applyPots) applySpeedPotionEffects(.2873) else .2873
val adjSpeed = speed * base // this seems to be what future does so its what people are expecting
val yaw = calcMoveYaw()
if (player.capabilities.isFlying
|| player.isElytraFlying
|| BaritoneUtils.isPathing
|| !isInputting) {
strafePhase = StandardPhase.HEAD_START
return@safeListener
}
when (mode) {
Mode.STANDARD -> {
when (strafePhase) {
StandardPhase.HEAD_START -> {
if (!player.onGround) {
strafePhase = StandardPhase.SLOWDOWN
return@safeListener
}
currentSpeed = adjSpeed / 2.149
strafePhase = StandardPhase.ACCELERATING
}
StandardPhase.ACCELERATING -> {
currentSpeed = adjSpeed
player.motionY = .424 // slightly higher than normal which is good for LJ
strafePhase = StandardPhase.SLOWDOWN
}
StandardPhase.SLOWDOWN -> {
currentSpeed -= .66 * base
strafePhase = StandardPhase.FALLING
}
StandardPhase.FALLING -> {
if (player.onGround) {
strafePhase = StandardPhase.ACCELERATING
return@safeListener
}
currentSpeed = lastDistance - lastDistance / 159
}
}
it.x = -sin(yaw) * currentSpeed
it.z = cos(yaw) * currentSpeed
if (
virtue
&& isInputting
&& world.collidesWithAnyBlock(player.entityBoundingBox.shrink(0.0625).expand(0.0, -0.55, 0.0))
&& player.motionY < 0
&& currentSpeed > .29
&& strafePhase == StandardPhase.FALLING
) {
it.y = -1e-7
}
}
Mode.UPDATED -> {
// we cannot spam this on UpdatedNCP
if (jumpTick > 1 && player.onGround) {
disable()
return@safeListener
}
if (player.onGround) {
player.jump()
it.x = -sin(yaw) * base
it.z = cos(yaw) * base
jumpTick = 1
return@safeListener
}
if (++jumpTick == 2) {
it.x = -sin(yaw) * adjSpeed
it.z = cos(yaw) * adjSpeed
return@safeListener
}
if (jumpTick < 8) {
val newSpeed = lastDistance - lastDistance / 159
it.x = -sin(yaw) * newSpeed
it.z = cos(yaw) * newSpeed
}
if (
virtue
&& isInputting
&& world.collidesWithAnyBlock(player.entityBoundingBox.shrink(0.0625).expand(0.0, -0.55, 0.0))
&& player.motionY < 0
&& currentSpeed > .29
) {
it.y = -1e-7
}
}
}
}
}
private enum class StandardPhase {
// slide along the ground slower to bypass
HEAD_START,
// to jump and accelerate
ACCELERATING,
// to fall to the ground
SLOWDOWN,
// to slowly fall to the ground
FALLING
}
}