VehicleControl module

VehicleControl: Minecraft 26.3 cheat module, full source for every implementation (1 client: LiquidBounce (Kotlin)).

1 implementationMOVEMENT

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

LiquidBounce (Kotlin)MOVEMENTsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/ModuleVehicleControl.ktKotlin · 204 lines · 7.5 KB

Allows you to fly and speed while riding an entity (like boats or horses).

SettingsHorizontalVerticalGlideMouseControlNoGlideOnSprintUnhookAfterHookAfter
ModuleVehicleControl.ktKotlin · Minecraft 26.2 · 204 lines · 7.5 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.movement
20
21
import net.ccbluex.liquidbounce.config.types.group.ToggleableValueGroup
22
import net.ccbluex.liquidbounce.config.types.group.ValueGroup
23
import net.ccbluex.liquidbounce.event.events.MovementInputEvent
24
import net.ccbluex.liquidbounce.event.handler
25
import net.ccbluex.liquidbounce.event.once
26
import net.ccbluex.liquidbounce.event.tickHandler
27
import net.ccbluex.liquidbounce.event.waitTicks
28
import net.ccbluex.liquidbounce.features.module.ClientModule
29
import net.ccbluex.liquidbounce.features.module.ModuleCategories
30
import net.ccbluex.liquidbounce.features.module.modules.combat.ModuleSpearKill
31
import net.ccbluex.liquidbounce.utils.client.chat
32
import net.ccbluex.liquidbounce.utils.client.warning
33
import net.ccbluex.liquidbounce.utils.entity.boxedDistanceTo
34
import net.ccbluex.liquidbounce.utils.entity.getMovementDirectionOfInput
35
import net.ccbluex.liquidbounce.utils.entity.interactEntity
36
import net.ccbluex.liquidbounce.utils.entity.moving
37
import net.ccbluex.liquidbounce.utils.entity.withStrafe
38
import net.ccbluex.liquidbounce.utils.math.copy
39
import net.ccbluex.liquidbounce.utils.movement.DirectionalInput
40
41
/**
42
 * Vehicle control module
43
 *
44
 * Move with your vehicle however you want.
45
 */
46
object ModuleVehicleControl : ClientModule("VehicleControl", ModuleCategories.MOVEMENT, aliases = listOf("BoatFly")) {
47
48
    private object BaseSpeed : ValueGroup("BaseSpeed") {
49
        val horizontalSpeed by float("Horizontal", 0.5f, 0.1f..10f)
50
        val verticalSpeed by float("Vertical", 0.35f, 0.1f..10f)
51
    }
52
53
    private object SprintSpeed : ToggleableValueGroup(this, "SprintSpeed", true) {
54
        val horizontalSpeed by float("Horizontal", 5f, 0.1f..10f)
55
        val verticalSpeed by float("Vertical", 2f, 0.1f..10f)
56
    }
57
58
    private val glide by float("Glide", -0.15f, -0.3f..0.3f)
59
60
    private val mouseControl by boolean("MouseControl", false)
61
    private val noGlideOnSprint by boolean("NoGlideOnSprint", false, aliases = listOf("NoGlideOnSpring"))
62
63
    init {
64
        tree(BaseSpeed)
65
        tree(SprintSpeed)
66
        tree(Rehook)
67
    }
68
69
    private var wasInVehicle = false
70
71
    override fun onEnabled() {
72
        chat(warning(message("quitHelp")))
73
        super.onEnabled()
74
    }
75
76
    @Suppress("unused")
77
    private val handleVehicleMovement = tickHandler {
78
        val vehicle = player.controlledVehicle ?: run {
79
            wasInVehicle = false
80
            return@tickHandler
81
        }
82
83
        // Show explanation message
84
        if (!wasInVehicle && mc.options.keyUse.isDown) {
85
            wasInVehicle = true
86
            chat(warning(message("quitHelp")))
87
        }
88
89
        val useSprintSpeed = mc.options.keySprint.isDown && SprintSpeed.enabled
90
        val hSpeed =
91
            if (useSprintSpeed) SprintSpeed.horizontalSpeed else BaseSpeed.horizontalSpeed
92
        val vSpeed =
93
            if (useSprintSpeed) SprintSpeed.verticalSpeed else BaseSpeed.verticalSpeed
94
95
        // Control vehicle
96
        val horizontalSpeed = if (player.moving) hSpeed.toDouble() else 0.0
97
98
        if (mouseControl) {
99
            vehicle.yRot = player.yRot
100
            vehicle.yRotO = player.yRot
101
        }
102
103
        val verticalSpeed = when {
104
            mc.options.keyJump.isDown -> vSpeed.toDouble()
105
            mc.options.keyShift.isDown -> -vSpeed.toDouble()
106
            // If we do not stop the vehicle from going down when touching water, it will
107
            // drown in water and cannot be controlled anymore
108
            !vehicle.isInWater &&
109
                !(useSprintSpeed && noGlideOnSprint) // No glide option
110
                -> glide.toDouble()
111
112
            else -> 0.0
113
        }
114
115
        val spearDashVelocity =
116
            if (ModuleSpearKill.enabled) {
117
                val dashSpeed = ModuleSpearKill.currentAttackVelocity
118
                if (dashSpeed != 0.0) {
119
                    ModuleSpearKill.currentAttackDirection.scale(dashSpeed)
120
                } else {
121
                    null
122
                }
123
            } else {
124
                null
125
            }
126
127
        // Vehicle control velocity
128
        val input = DirectionalInput(player.input)
129
        val movementYaw = getMovementDirectionOfInput(vehicle.yRot, input)
130
        vehicle.deltaMovement = spearDashVelocity
131
            ?: vehicle.deltaMovement
132
                .copy(y = verticalSpeed)
133
                .withStrafe(yaw = movementYaw, speed = horizontalSpeed)
134
    }
135
136
    @Suppress("unused")
137
    private val handleMovementInputEvent = handler<MovementInputEvent> { event ->
138
        if (player.controlledVehicle != null || Rehook.vehicleId >= 0) {
139
            val isVehicleSafe = player.controlledVehicle?.let { it.onGround() || it.isInWater } == true
140
141
            // Do not quit vehicle if not safe to do so
142
            event.sneak = event.sneak && isVehicleSafe
143
144
            if (event.sneak) {
145
                Rehook.vehicleId = -1
146
            }
147
        }
148
    }
149
150
    /**
151
     * Bypasses BoatFly checks on anti-cheats such as Vulcan 2.9.1
152
     */
153
    object Rehook : ToggleableValueGroup(this, "Rehook", false) {
154
155
        private var unhookAfter by int("UnhookAfter", 4, 1..10)
156
        private var hookAfter by int("HookAfter", 2, 1..10)
157
158
        internal var vehicleId = -1
159
        private var forceAttempt = false
160
161
        @Suppress("unused")
162
        private val handleRehooking = tickHandler {
163
            if (vehicleId >= 0 && !player.isPassenger) {
164
                val vehicle = world.getEntity(vehicleId)
165
166
                if (vehicle != null && !vehicle.isRemoved) {
167
                    // Check if the player is able to reach the vehicle
168
                    if (vehicle.boxedDistanceTo(player) > player.entityInteractionRange()) {
169
                        chat(warning(message("vehicleTooFar")))
170
                        vehicleId = -1
171
                        return@tickHandler
172
                    }
173
174
                    // Enter the vehicle again
175
                    if (!forceAttempt) {
176
                        interactEntity(vehicle)
177
                        forceAttempt = true
178
                    } else {
179
                        // We are already in the vehicle on the server-side, but our client does not know that, so
180
                        // we force the client to enter the vehicle again
181
                        player.startRiding(vehicle, true, true)
182
                    }
183
                } else {
184
                    chat(warning(message("vehicleGone")))
185
                    vehicleId = -1
186
                }
187
            } else {
188
                forceAttempt = false
189
190
                waitTicks(unhookAfter)
191
                vehicleId = player.controlledVehicle?.id ?: return@tickHandler
192
                once<MovementInputEvent> {
193
                    it.sneak = true
194
                    player.stopRiding()
195
                }
196
                waitTicks(hookAfter - 1)
197
            }
198
        }
199
200
    }
201
202
203
}
204