Clip module

Clip: 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/exploit/ModuleClip.ktKotlin · 220 lines · 8.1 KB

Allows you to clip through blocks.

SettingsHorizontalVerticalResetVelocityAllowedLiquidsRequiresStandOn
ModuleClip.ktKotlin · Minecraft 26.2 · 220 lines · 8.1 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.exploit
20
21
import net.ccbluex.fastutil.enumSetOf
22
import net.ccbluex.liquidbounce.config.types.group.Mode
23
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
24
import net.ccbluex.liquidbounce.config.types.list.Tagged
25
import net.ccbluex.liquidbounce.event.events.NotificationEvent
26
import net.ccbluex.liquidbounce.event.events.OverlayRenderEvent
27
import net.ccbluex.liquidbounce.event.handler
28
import net.ccbluex.liquidbounce.event.tickHandler
29
import net.ccbluex.liquidbounce.event.waitTicks
30
import net.ccbluex.liquidbounce.features.module.ClientModule
31
import net.ccbluex.liquidbounce.features.module.ModuleCategories
32
import net.ccbluex.liquidbounce.features.module.modules.movement.fly.ModuleFly
33
import net.ccbluex.liquidbounce.render.engine.type.Color4b
34
import net.ccbluex.liquidbounce.utils.block.canStandOn
35
import net.ccbluex.liquidbounce.utils.block.state
36
import net.ccbluex.liquidbounce.utils.client.notification
37
import net.ccbluex.liquidbounce.utils.client.scaledDimension
38
import net.ccbluex.liquidbounce.utils.collection.Pools
39
import net.ccbluex.liquidbounce.utils.math.toRadians
40
import net.minecraft.core.BlockPos
41
import net.minecraft.core.Direction
42
import net.minecraft.tags.FluidTags
43
import net.minecraft.tags.TagKey
44
import net.minecraft.world.level.material.Fluid
45
import kotlin.math.cos
46
import kotlin.math.sin
47
48
/**
49
 * Clip module
50
 *
51
 * Allows you to clip through blocks by jumping or sneaking.
52
 */
53
object ModuleClip : ClientModule("Clip", ModuleCategories.MOVEMENT) {
54
55
    private val modes = choices("Choice", Fancy, arrayOf(Fancy, Old))
56
57
    private enum class AllowedLiquids(override val tag: String, val fluidTag: TagKey<Fluid>) : Tagged {
58
        WATER("Water", FluidTags.WATER),
59
        LAVA("Lava", FluidTags.LAVA);
60
    }
61
62
    private object Old : Mode("Old") {
63
64
        override val parent: ModeValueGroup<Mode>
65
            get() = modes
66
67
        private val horizontal by float("Horizontal", 0f, -10f..10f)
68
        private val vertical by float("Vertical", 5f, -10f..10f)
69
        private val resetVelocity by boolean("ResetVelocity", true)
70
71
        override fun enable() {
72
            val yaw = player.yRot.toRadians()
73
            val x = -sin(yaw) * horizontal
74
            val z = cos(yaw) * horizontal
75
76
            player.absSnapTo(player.x + x, player.y + vertical, player.z + z)
77
            if (resetVelocity) {
78
                player.setDeltaMovement(0.0, 0.0, 0.0)
79
            }
80
            enabled = false
81
        }
82
    }
83
84
    private object Fancy : Mode("Fancy") {
85
86
        override val parent: ModeValueGroup<Mode>
87
            get() = modes
88
89
        private val horizontal by int("Horizontal", 0, 0..6)
90
        private val vertical by int("Vertical", 5, 0..10)
91
        private val allowedLiquids by multiEnumChoice("AllowedLiquids", enumSetOf<AllowedLiquids>())
92
93
        private val requiresStandOn by boolean("RequiresStandOn", true)
94
95
        private val possibleClipDirections = enumSetOf<Direction>()
96
97
        @Suppress("unused")
98
        val repeatable = tickHandler {
99
            possibleClipDirections.clear()
100
101
            if (ModuleFly.running) {
102
                return@tickHandler
103
            }
104
105
            arrayOf(Direction.UP, Direction.DOWN).forEach { direction ->
106
                tryClip(direction, vertical) {
107
                    possibleClipDirections.add(direction)
108
                }
109
            }
110
111
            val movementDirection = when {
112
                player.horizontalCollision -> when {
113
                    mc.options.keyUp.isDown -> player.direction
114
                    mc.options.keyDown.isDown -> player.direction.opposite
115
                    mc.options.keyLeft.isDown -> player.direction.getClockWise(Direction.Axis.Y).opposite
116
                    mc.options.keyRight.isDown -> player.direction.getClockWise(Direction.Axis.Y)
117
                    else -> return@tickHandler
118
                }
119
120
                mc.options.keyShift.isDown -> Direction.DOWN
121
                mc.options.keyJump.isDown -> Direction.UP
122
                else -> return@tickHandler
123
            }
124
125
            val clipLength = when (movementDirection) {
126
                Direction.DOWN, Direction.UP -> vertical
127
                else -> horizontal
128
            }
129
130
            tryClip(movementDirection, clipLength) { blockPos ->
131
                // Set the new position
132
                player.absSnapTo(blockPos.x + 0.5, blockPos.y.toDouble(), blockPos.z + 0.5)
133
134
                notification("Clip", message("whoosh"), NotificationEvent.Severity.SUCCESS)
135
            }
136
137
            waitTicks(5)
138
        }
139
140
        @Suppress("unused")
141
        val overlayRenderHandler = handler<OverlayRenderEvent> { event ->
142
            if (possibleClipDirections.isEmpty()) {
143
                return@handler
144
            }
145
146
            val directionString = Pools.buildStringPooled {
147
                append("[ ")
148
                if (possibleClipDirections.contains(Direction.UP)) {
149
                    append('▲')
150
                }
151
                if (possibleClipDirections.contains(Direction.DOWN)) {
152
                    append('▼')
153
                }
154
                append(" ]")
155
            }
156
157
            // Draw it to the right of the crosshair
158
            val (width, height) = mc.window.scaledDimension
159
160
            // Since we cannot use the LiquidBounce FontRenderer for characters like ▲ and ▼
161
            // we have to use the Minecraft FontRenderer.
162
            // Another option would be to pass the text to the JCEF HUD and render it there.
163
            // But that would be a lot of work for a simple arrow.
164
            // todo: maybe add a font renderer that supports unicode characters?
165
            //   or a way to pass text to the JCEF HUD
166
            event.context.text(
167
                mc.font,
168
                directionString,
169
                width / 2 + 10,
170
                height / 2 - mc.font.lineHeight / 2 + 1,
171
                Color4b.WHITE.argb
172
            )
173
        }
174
175
        private inline fun tryClip(movementDirection: Direction, length: Int, clip: (BlockPos) -> Unit) {
176
            if (length == 0) {
177
                return
178
            }
179
180
            var wallBetween = false
181
182
            // Calculate the new position
183
            // Find the closest free block to clip into
184
            val position = player.blockPosition().mutable()
185
            repeat(length) {
186
                position.move(movementDirection)
187
188
                if (isPossibleLocation(
189
                        position, requiresStandOn = requiresStandOn &&
190
                            movementDirection != Direction.UP
191
                    )
192
                ) {
193
                    // We do not want to clip if there is no wall between us
194
                    if (wallBetween) {
195
                        clip(position)
196
                        return
197
                    }
198
                } else {
199
                    wallBetween = true
200
                }
201
            }
202
        }
203
204
        private fun isPossibleLocation(blockPos: BlockPos, requiresStandOn: Boolean = true): Boolean {
205
            if (requiresStandOn && !blockPos.below().canStandOn()) {
206
                return false
207
            }
208
209
            val blockState = blockPos.state ?: return false
210
            val aboveState = blockPos.above().state ?: return false
211
212
            return (blockState.isAir && aboveState.isAir) || allowedLiquids.any {
213
                blockState.fluidState.`is`(it.fluidTag) &&
214
                    (aboveState.isAir || aboveState.fluidState.`is`(it.fluidTag))
215
            }
216
        }
217
    }
218
219
}
220