@@ -13,6 +13,7 @@ import com.lambda.client.module.Module
13
13
import com.lambda.client.util.MovementUtils
14
14
import com.lambda.client.util.MovementUtils.calcMoveYaw
15
15
import com.lambda.client.util.threads.runSafe
16
+ import com.lambda.client.util.threads.runSafeR
16
17
import com.lambda.client.util.threads.safeListener
17
18
import net.minecraft.network.play.client.CPacketConfirmTeleport
18
19
import net.minecraft.network.play.client.CPacketPlayer
@@ -40,7 +41,7 @@ object Flight : Module(
40
41
private val packetMode by setting(" Packet Mode" , PacketMode .FAST , { mode == FlightMode .PACKET })
41
42
private val bounds by setting(" Packet Type" , PacketType .NEGATIVE , { mode == FlightMode .PACKET })
42
43
private val factor by setting(" Bypass Factor" , 1f , 0f .. 10f , .1f , { mode == FlightMode .PACKET })
43
- private val concealFactor by setting(" Conceal Factor" , 2f ,0f .. 10f , .1f , { mode == FlightMode .PACKET })
44
+ private val concealFactor by setting(" Conceal Factor" , 2f , 0f .. 10f , .1f , { mode == FlightMode .PACKET })
44
45
private val conceal by setting(" Conceal" , false , { mode == FlightMode .PACKET })
45
46
private val antiKick by setting(" Anti Kick" , true , { mode == FlightMode .PACKET })
46
47
@@ -69,7 +70,6 @@ object Flight : Module(
69
70
init {
70
71
onDisable {
71
72
runSafe {
72
-
73
73
tpID = - 1
74
74
ticksEnabled = 0
75
75
player.noClip = false
@@ -78,32 +78,27 @@ object Flight : Module(
78
78
isFlying = false
79
79
flySpeed = 0.05f
80
80
}
81
-
82
81
}
83
82
}
84
83
85
84
onEnable {
86
- runSafe {
85
+ runSafeR {
87
86
val position = CPacketPlayer .Position (.0 , .0 , .0 , true )
88
87
filter.add(position)
89
88
connection.sendPacket(position)
90
- }
89
+ } ? : disable()
91
90
}
92
91
93
92
safeListener<PlayerMoveEvent > {
94
93
when (mode) {
95
-
96
94
// uses the same concepts as https://gist.github.com/Doogie13/aa04c6a8eb496c1afdb9c675e2ebd91c
97
95
// completely written from scratch, however
98
96
FlightMode .PACKET -> {
99
-
100
97
player.noClip = true
101
98
102
99
// region Motion
103
100
val concealing = world.collidesWithAnyBlock(player.entityBoundingBox) || conceal
104
-
105
101
var motionY: Double
106
-
107
102
var up = 0
108
103
109
104
// we must use else if to allow phasing
@@ -112,11 +107,10 @@ object Flight : Module(
112
107
else if (mc.gameSettings.keyBindSneak.isKeyDown)
113
108
up--
114
109
115
- motionY =
116
- if (up == 0 )
117
- .0
118
- else
119
- CONCEAL_SPEED * up.toDouble()
110
+ motionY = if (up == 0 )
111
+ .0
112
+ else
113
+ CONCEAL_SPEED * up.toDouble()
120
114
121
115
var motionXZ: Double = if (! MovementUtils .isInputting)
122
116
.0
@@ -167,8 +161,7 @@ object Flight : Module(
167
161
var currentY = if (antiKick && ticksEnabled % 10 == 0 ) - ANTIKICK_AMOUNT else baseY
168
162
var currentZ = baseZ
169
163
170
- for (i in 1 .. (factorInt)) {
171
-
164
+ for (i in 1 .. factorInt) {
172
165
// should never happen
173
166
if (i > 10 )
174
167
break
@@ -179,30 +172,20 @@ object Flight : Module(
179
172
180
173
// region bounds
181
174
when (bounds) {
182
-
183
175
PacketType .STRICT -> {
184
-
185
176
var random = (Math .random() * 256 ) + 256
186
177
187
178
(random + player.posY > (if (player.dimension == - 1 ) 127 else 255 ))
188
179
random * = - 1
189
180
190
181
yOffset = random
191
-
192
182
}
193
-
194
183
PacketType .POSITIVE -> {
195
-
196
184
yOffset = 1337.0
197
-
198
185
}
199
-
200
186
PacketType .NEGATIVE -> {
201
-
202
187
yOffset = - 1337.0
203
-
204
188
}
205
-
206
189
}
207
190
// endregion
208
191
@@ -236,16 +219,12 @@ object Flight : Module(
236
219
player.setVelocity(.0 , .0 , .0 )
237
220
238
221
}
239
-
240
222
FlightMode .STATIC -> {
241
-
242
223
var up = 0
243
224
244
- if (mc.gameSettings.keyBindJump.isKeyDown)
245
- up++
225
+ if (mc.gameSettings.keyBindJump.isKeyDown) up++
246
226
247
- if (mc.gameSettings.keyBindSneak.isKeyDown)
248
- up--
227
+ if (mc.gameSettings.keyBindSneak.isKeyDown) up--
249
228
250
229
player.motionY = if (up == 0 ) - glideSpeed else speed * up.toDouble()
251
230
@@ -257,7 +236,6 @@ object Flight : Module(
257
236
player.motionZ + = cos(yaw) * speed
258
237
259
238
}
260
-
261
239
FlightMode .VANILLA -> {
262
240
player.capabilities.isFlying = true
263
241
player.capabilities.flySpeed = speed / 11.11f
@@ -266,9 +244,7 @@ object Flight : Module(
266
244
&& ! mc.gameSettings.keyBindJump.isKeyDown
267
245
&& ! mc.gameSettings.keyBindSneak.isKeyDown) player.motionY = - glideSpeed
268
246
}
269
-
270
247
}
271
-
272
248
}
273
249
274
250
listener<OnUpdateWalkingPlayerEvent > {
@@ -279,57 +255,39 @@ object Flight : Module(
279
255
}
280
256
281
257
safeListener<PacketEvent .Receive > {
258
+ if (mode != FlightMode .PACKET ) return @safeListener
282
259
283
- if (mode != FlightMode .PACKET )
284
- return @safeListener
285
-
286
- when (it.packet) {
287
-
260
+ when (val packet = it.packet) {
288
261
is SPacketPlayerPosLook -> {
289
-
290
- val packet = it.packet
291
262
val id = packet.teleportId
292
263
293
- if (history.containsKey(id) && tpID != - 1 ) {
294
-
295
- val vec = history[id]
296
-
297
- if (vec != null ) {
298
-
264
+ if (history.containsKey(packet.teleportId) && tpID != - 1 ) {
265
+ history[id]?.let { vec ->
299
266
if (vec.x == packet.x && vec.y == packet.y && vec.z == packet.z) {
300
-
301
267
if (packetMode != PacketMode .SETBACK )
302
268
it.cancel()
303
269
304
270
history.remove(id)
305
-
306
271
player.connection.sendPacket(CPacketConfirmTeleport (id))
307
-
308
272
return @safeListener
309
-
310
273
}
311
-
312
274
}
313
275
}
314
276
315
- it. packet.playerPosLookYaw = player.rotationYaw
316
- it. packet.playerPosLookPitch = player.rotationPitch
277
+ packet.playerPosLookYaw = player.rotationYaw
278
+ packet.playerPosLookPitch = player.rotationPitch
317
279
318
280
player.connection.sendPacket(CPacketConfirmTeleport (id))
319
281
320
282
tpID = id
321
-
322
283
}
323
-
324
284
is SPacketCloseWindow -> {
325
285
it.cancel()
326
286
}
327
-
328
287
}
329
288
}
330
289
331
290
safeListener<PacketEvent .Send > {
332
-
333
291
if (mode != FlightMode .PACKET || it.packet !is CPacketPlayer ) return @safeListener
334
292
335
293
if (! filter.contains(it.packet))
@@ -338,6 +296,5 @@ object Flight : Module(
338
296
filter.remove(it.packet)
339
297
340
298
}
341
-
342
299
}
343
300
}
0 commit comments