SuperKnockback module

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

1 implementationCOMBAT

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)COMBATsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleSuperKnockback.ktKotlin · 243 lines · 8.9 KB

Increases knockback dealt to other entities.

SettingsHurtTimeConditionsOnlyForwardReSprintUntilMovementBlockUntilAllowedMovement
ModuleSuperKnockback.ktKotlin · Minecraft 26.2 · 243 lines · 8.9 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.combat
20
21
import net.ccbluex.liquidbounce.config.types.group.Mode
22
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
23
import net.ccbluex.liquidbounce.config.types.group.ToggleableValueGroup
24
import net.ccbluex.liquidbounce.config.types.list.Tagged
25
import net.ccbluex.liquidbounce.config.utils.percentageChance
26
import net.ccbluex.liquidbounce.event.events.AttackEntityEvent
27
import net.ccbluex.liquidbounce.event.events.MovementInputEvent
28
import net.ccbluex.liquidbounce.event.events.SprintEvent
29
import net.ccbluex.liquidbounce.event.handler
30
import net.ccbluex.liquidbounce.event.sequenceHandler
31
import net.ccbluex.liquidbounce.event.tickUntil
32
import net.ccbluex.liquidbounce.event.waitTicks
33
import net.ccbluex.liquidbounce.features.module.ClientModule
34
import net.ccbluex.liquidbounce.features.module.ModuleCategories
35
import net.ccbluex.liquidbounce.features.module.modules.combat.criticals.ModuleCriticals
36
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleDebug.debugParameter
37
import net.ccbluex.liquidbounce.utils.network.sendStartSprinting
38
import net.ccbluex.liquidbounce.utils.network.sendStopSprinting
39
import net.ccbluex.liquidbounce.utils.entity.isInsideWaterOrBubbleColumn
40
import net.ccbluex.liquidbounce.utils.entity.movementForward
41
import net.ccbluex.liquidbounce.utils.entity.movementSideways
42
import net.ccbluex.liquidbounce.utils.kotlin.EventPriorityConvention.CRITICAL_MODIFICATION
43
import net.ccbluex.liquidbounce.utils.kotlin.matchesAll
44
import net.ccbluex.liquidbounce.utils.math.minus
45
import net.ccbluex.liquidbounce.utils.movement.DirectionalInput
46
import net.minecraft.world.entity.Entity
47
import net.minecraft.world.entity.LivingEntity
48
import java.util.function.Predicate
49
50
/**
51
 * SuperKnockback module
52
 *
53
 * Increases knockback dealt to other entities.
54
 */
55
@Suppress("MagicNumber")
56
object ModuleSuperKnockback : ClientModule("SuperKnockback", ModuleCategories.COMBAT, aliases = listOf("WTap")) {
57
58
    val modes = choices("Mode", Packet, arrayOf(Packet, SprintTap, WTap)).apply(::tagBy)
59
    val hurtTime by int("HurtTime", 10, 0..10)
60
    val chance = percentageChance("Chance", 100f)
61
    private val conditions by multiEnumChoice("Conditions", Conditions.NOT_IN_WATER)
62
63
    @Suppress("unused")
64
    private enum class Conditions(
65
        override val tag: String,
66
        private val testCondition: Predicate<Entity>,
67
    ) : Tagged, Predicate<Entity> by testCondition {
68
        ONLY_FACING("OnlyFacing", { target ->
69
            target.lookAngle.dot(player.position() - target.position()) < 0
70
        }),
71
        ONLY_ON_GROUND("OnlyOnGround", { _ ->
72
            player.onGround()
73
        }),
74
        NOT_IN_WATER("NotInWater", { _ ->
75
            !player.isInsideWaterOrBubbleColumn
76
        }),
77
    }
78
79
    private object OnlyOnMove : ToggleableValueGroup(this, "OnlyOnMove", true) {
80
        val onlyForward by boolean("OnlyForward", true)
81
    }
82
83
    init {
84
        tree(OnlyOnMove)
85
    }
86
87
    object Packet : Mode("Packet") {
88
        override val parent: ModeValueGroup<Mode>
89
            get() = modes
90
91
        @Suppress("unused", "ComplexCondition")
92
        private val attackHandler = handler<AttackEntityEvent> { event ->
93
            val enemy = event.entity
94
95
            if (!shouldOperate(enemy)) {
96
                return@handler
97
            }
98
99
            if (enemy is LivingEntity
100
                && enemy.hurtTime <= hurtTime && chance.asBoolean
101
                && !ModuleCriticals.wouldDoCriticalHit()
102
            ) {
103
                if (player.isSprinting) {
104
                    network.sendStopSprinting()
105
                }
106
107
                network.sendStartSprinting()
108
                network.sendStopSprinting()
109
                network.sendStartSprinting()
110
111
                player.isSprinting = true
112
                player.wasSprinting = true
113
            }
114
        }
115
    }
116
117
    object SprintTap : Mode("SprintTap") {
118
        override val parent: ModeValueGroup<Mode>
119
            get() = modes
120
121
        private val reSprintTicks by intRange("ReSprint", 0..1, 0..10, "ticks")
122
123
        private var cancelSprint = false
124
125
        @Suppress("unused", "ComplexCondition")
126
        private val attackHandler = sequenceHandler<AttackEntityEvent>(
127
            onCancellation = {
128
                cancelSprint = false
129
                this@SprintTap.debugParameter("State") { "Allowing Sprint (Cancellation)" }
130
            }
131
        ) { event ->
132
            if (!shouldOperate(event.entity) || !shouldStopSprinting(event) || cancelSprint) {
133
                return@sequenceHandler
134
            }
135
136
            this@SprintTap.debugParameter("State") { "Disallowing Sprint" }
137
            cancelSprint = true
138
            tickUntil {
139
                val player = mc.player ?: return@tickUntil true
140
                !player.isSprinting && !player.wasSprinting
141
            }
142
            this@SprintTap.debugParameter("State") { "Waiting for ReSprint" }
143
            waitTicks(reSprintTicks.random())
144
            this@SprintTap.debugParameter("State") { "Allowing Sprint" }
145
            cancelSprint = false
146
        }
147
148
        @Suppress("unused")
149
        private val movementHandler = handler<SprintEvent>(
150
            priority = CRITICAL_MODIFICATION
151
        ) { event ->
152
            if (cancelSprint && (event.source == SprintEvent.Source.MOVEMENT_TICK ||
153
                    event.source == SprintEvent.Source.INPUT)) {
154
                event.sprint = false
155
            }
156
        }
157
158
        override fun disable() {
159
            cancelSprint = false
160
            super.disable()
161
        }
162
163
    }
164
165
    object WTap : Mode("WTap") {
166
        override val parent: ModeValueGroup<Mode>
167
            get() = modes
168
169
        private val ticksUntilMovementBlock by intRange("UntilMovementBlock", 0..1, 0..10,
170
            "ticks")
171
        private val ticksUntilAllowedMovement by intRange("UntilAllowedMovement", 0..1, 0..10,
172
            "ticks")
173
174
        private var inSequence = false
175
        private var cancelMovement = false
176
177
        @Suppress("unused", "ComplexCondition")
178
        private val attackHandler = sequenceHandler<AttackEntityEvent>(
179
            onCancellation = {
180
                cancelMovement = false
181
                inSequence = false
182
                this@WTap.debugParameter("State") { "Allowing Movement (Cancellation)" }
183
            }
184
        ) { event ->
185
            if (!shouldOperate(event.entity) || !shouldStopSprinting(event) || inSequence) {
186
                return@sequenceHandler
187
            }
188
189
            inSequence = true
190
            this@WTap.debugParameter("State") { "Waiting for Movement Block" }
191
            waitTicks(ticksUntilMovementBlock.random())
192
            this@WTap.debugParameter("State") { "Disallowing Movement" }
193
            cancelMovement = true
194
            tickUntil { !player.input.hasForwardImpulse() }
195
            this@WTap.debugParameter("State") { "Waiting for Allowed Movement" }
196
            waitTicks(ticksUntilAllowedMovement.random())
197
            this@WTap.debugParameter("State") { "Allowing Movement" }
198
            cancelMovement = false
199
            inSequence = false
200
        }
201
202
        @Suppress("unused")
203
        private val movementHandler = handler<MovementInputEvent> { event ->
204
            if (inSequence && cancelMovement) {
205
                event.directionalInput = DirectionalInput.NONE
206
            }
207
        }
208
209
        override fun disable() {
210
            cancelMovement = false
211
            inSequence = false
212
            super.disable()
213
        }
214
215
    }
216
217
    private fun shouldStopSprinting(event: AttackEntityEvent): Boolean {
218
        val enemy = event.entity
219
220
        if (!player.isSprinting || !player.wasSprinting) {
221
            return false
222
        }
223
224
        return enemy is LivingEntity && enemy.hurtTime <= hurtTime && chance.asBoolean
225
            && !ModuleCriticals.wouldDoCriticalHit()
226
    }
227
228
    @Suppress("ReturnCount")
229
    private fun shouldOperate(target: Entity): Boolean {
230
        if (OnlyOnMove.enabled) {
231
            val isMovingSideways = player.input.movementSideways != 0f
232
            val isMoving = player.input.movementForward != 0f || isMovingSideways
233
234
            if (!isMoving || (OnlyOnMove.onlyForward && isMovingSideways)) {
235
                return false
236
            }
237
        }
238
239
        return conditions.matchesAll(target)
240
    }
241
242
}
243