11package com.lambda.module.modules.movement
22
3- import baritone.api.utils.Helper
43import com.lambda.event.events.TickEvent
54import com.lambda.event.listener.SafeListener.Companion.listener
65import com.lambda.module.Module
76import com.lambda.module.tag.ModuleTag
7+ import net.minecraft.enchantment.EnchantmentHelper
88import net.minecraft.entity.MovementType
99import net.minecraft.item.TridentItem
1010import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket
@@ -22,8 +22,10 @@ object TridentFlight : Module(
2222 description = " Allows you to fly with tridents" ,
2323 defaultTags = setOf(ModuleTag .MOVEMENT , ModuleTag .BYPASS , ModuleTag .GRIM ),
2424) {
25- private val delay by setting(" Delay" , 0 , 0 .. 20 , 1 , description = " Delay in ticks before releasing the trident" )
26- private val grimBypass by setting(" Grim Bypass" , true , description = " Bypass Grim's trident flight check" )
25+ private val bounce by setting(" Bounce" , true , description = " Automatically use the trident" )
26+ private val delay by setting(" Delay" , 0 , 0 .. 20 , 1 , description = " Delay in ticks before releasing the trident" , visibility = { bounce })
27+ private val tridentSpeed by setting(" Speed Factor" , 1.0 , 0.1 .. 5.0 , 0.1 , description = " Speed factor of the trident flight" )
28+
2729 val rain by setting(" Rain" , true , description = " Set rain client-side to allow flight" )
2830
2931 private var ticks = 0
@@ -39,22 +41,25 @@ object TridentFlight : Module(
3941 connection.sendPacket(UpdateSelectedSlotC2SPacket (tridentSlot))
4042 connection.sendPacket(PlayerActionC2SPacket (PlayerActionC2SPacket .Action .RELEASE_USE_ITEM , BlockPos .ORIGIN , Direction .DOWN ))
4143
42- if (grimBypass) {
43- val yaw = player.yaw * (Math .PI / 180 )
44- val pitch = player.pitch * (Math .PI / 180 )
44+ val level = EnchantmentHelper .getRiptide(player.activeItem)
45+ val yaw = player.yaw * (Math .PI / 180 )
46+ val pitch = player.pitch * (Math .PI / 180 )
4547
46- val x = - sin(yaw) * cos(pitch)
47- val y = - sin(pitch)
48- val z = cos(yaw) * cos(pitch)
48+ val x = - sin(yaw) * cos(pitch)
49+ val y = - sin(pitch)
50+ val z = cos(yaw) * cos(pitch)
4951
50- val dot = sqrt(x * x + y * y + z * z)
51- val multiplier = 3 / dot
52+ val dot = sqrt(x * x + y * y + z * z)
53+ val multiplier = ( 3 * (( 1.0 + level) / 4.0 )) / dot
5254
53- player.addVelocity(x * multiplier, y * multiplier, z * multiplier)
55+ player.addVelocity(
56+ x * multiplier * tridentSpeed,
57+ y * multiplier * tridentSpeed,
58+ z * multiplier * tridentSpeed
59+ )
5460
55- if (player.isOnGround)
56- player.move(MovementType .SELF , Vec3d (0.0 , 1.2 , 0.0 ))
57- }
61+ if (player.isOnGround)
62+ player.move(MovementType .SELF , Vec3d (0.0 , 1.19999 , 0.0 ))
5863
5964 connection.sendPacket(UpdateSelectedSlotC2SPacket (spoofSlot))
6065
0 commit comments