HandDerp module

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

1 implementationFUN

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)FUNsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/fun/ModuleHandDerp.ktKotlin · 121 lines · 3.9 KB

Switches between main and offhand constantly.

SettingsSilentDelay
ModuleHandDerp.ktKotlin · Minecraft 26.2 · 121 lines · 3.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.`fun`
20
21
import net.ccbluex.liquidbounce.config.types.group.Mode
22
import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup
23
import net.ccbluex.liquidbounce.event.events.PacketEvent
24
import net.ccbluex.liquidbounce.event.sequenceHandler
25
import net.ccbluex.liquidbounce.event.tickHandler
26
import net.ccbluex.liquidbounce.event.waitTicks
27
import net.ccbluex.liquidbounce.features.module.ClientModule
28
import net.ccbluex.liquidbounce.features.module.ModuleCategories
29
import net.minecraft.network.protocol.common.ServerboundClientInformationPacket
30
import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket
31
import net.minecraft.network.protocol.game.ServerboundSwingPacket
32
import net.minecraft.server.level.ClientInformation
33
34
35
/**
36
 * Hand derp module
37
 *
38
 * Switches your main hand.
39
 */
40
object ModuleHandDerp : ClientModule("HandDerp", ModuleCategories.FUN) {
41
42
43
    private val silent by boolean("Silent", false)
44
    private val mode = choices("Mode", Delay, arrayOf(Delay, Swing))
45
46
47
    private val originalHand = mc.options.mainHand().get()
48
    private var currentHand = mc.options.mainHand().get()
49
50
    private fun calculatePlayerPartValue(): Int {
51
        var value = 0
52
        for (part in mc.options.modelParts) {
53
            value = value or (1 shl part.ordinal)
54
        }
55
        return value
56
    }
57
58
    private fun switchHand() {
59
60
        currentHand = currentHand.opposite
61
        network.send(
62
            ServerboundClientInformationPacket(
63
                ClientInformation(
64
                    mc.options.languageCode,
65
                    mc.options.renderDistance().get(),
66
                    mc.options.chatVisibility().get(),
67
                    mc.options.chatColors().get(),
68
                    calculatePlayerPartValue(),
69
                    currentHand,
70
                    mc.isTextFilteringEnabled,
71
                    mc.options.allowServerListing().get(),
72
                    mc.options.particles().get()
73
                )
74
            )
75
        )
76
77
    }
78
79
    val packetHandler = sequenceHandler<PacketEvent>(priority = 1) {
80
        val packet = it.packet
81
        if (silent && packet is ClientboundSetEntityDataPacket &&
82
            packet.packedItems.any { data ->
83
                data.id == mc.options.mainHand().get().id }) {
84
            it.cancelEvent()
85
        }
86
    }
87
88
    override fun onDisabled() {
89
        if (mc.options.mainHand().get() != originalHand) {
90
            switchHand()
91
        }
92
    }
93
94
    private object Delay : Mode("Delay") {
95
        override val parent: ModeValueGroup<Mode>
96
            get() = mode
97
98
        val delayValue by int("Delay", 1, 0..20, "ticks")
99
100
        @Suppress("unused")
101
        val repeatable = tickHandler {
102
            waitTicks(delayValue)
103
            switchHand()
104
        }
105
    }
106
107
    private object Swing : Mode("Swing") {
108
        override val parent: ModeValueGroup<Mode>
109
            get() = mode
110
111
        @Suppress("unused")
112
        val packetHandler = sequenceHandler<PacketEvent>(priority = 1) {
113
            val packet = it.packet
114
            if (packet is ServerboundSwingPacket) {
115
                switchHand()
116
            }
117
        }
118
    }
119
120
}
121