To implement a new module named ExampleModule that makes the player jump every tick, you can follow the structure of existing modules in the LiquidBounce repository. Here's how you can do it:
Create a new Kotlin file for the module. Since the module is related to movement, it should be placed in the movement package, similar to ModuleNoJumpDelay.
Implement the module by extending ClientModule and overriding the necessary methods. Specifically, you'll need to handle the onTick event to make the player jump every tick.
Here's the implementation:
[Redacted
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.features.module.modules.movement
import net.ccbluex.liquidbounce.event.events.TickEvent
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.features.module.Category
import net.ccbluex.liquidbounce.features.module.ClientModule
import net.ccbluex.liquidbounce.utils.client.mc
/**
* ExampleModule makes the player jump every tick.
*/
object ExampleModule : ClientModule("ExampleModule", Category.MOVEMENT) {
// Event handler for the TickEvent
private val tickHandler = handler<TickEvent> {
if (mc.player != null) {
mc.player!!.jump()
}
}
// Optional: Override the enable method if you need to perform any setup when the module is enabled
override fun enable() {
super.enable()
// Additional setup logic can go here
}
// Optional: Override the disable method if you need to clean up when the module is disabled
override fun disable() {
super.disable()
// Cleanup logic can go here
}
}
Explanation:
Package Declaration: The module is placed in the movement package, which is consistent with other movement-related modules.
Module Declaration: The ExampleModule is declared as an object extending ClientModule. It belongs to the MOVEMENT category.
Tick Event Handling: A handler is registered for the TickEvent. Every time the game ticks, the player will jump if the module is enabled.
Optional Overrides: The enable and disable methods are overridden if you need to perform any additional setup or cleanup when the module is toggled.
Integration:
To integrate this module into the LiquidBounce client, you need to add it to the ModuleManager's registerInbuilt method, similar to how other modules are registered:
[Redacted
// In ModuleManager.kt
fun registerInbuilt() {
var builtin = arrayOf(
// Existing modules...
ExampleModule, // Add this line
// More existing modules...
)
builtin.forEach { module ->
addModule(module)
module.walkKeyPath()
module.verifyFallbackDescription()
}
}
This will ensure that the ExampleModule is registered and available in the client when it starts up.