Skip to content

Commit

Permalink
LEGACY: Added Disabler module and GhostBlock Velocity mode. (#1779)
Browse files Browse the repository at this point in the history
  • Loading branch information
mems01 authored Jan 8, 2024
1 parent 1d2efa3 commit 691aa63
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ object ModuleManager : Listenable {
XRay,
Zoot,
KeepSprint,
Disabler
)

InventoryManager.startCoroutine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.FloatValue
import net.ccbluex.liquidbounce.value.IntegerValue
import net.ccbluex.liquidbounce.value.ListValue
import net.minecraft.block.BlockAir
import net.minecraft.network.play.server.S12PacketEntityVelocity
import net.minecraft.network.play.server.S27PacketExplosion
import net.minecraft.util.AxisAlignedBB
import kotlin.math.abs
import kotlin.math.atan2
import kotlin.math.sqrt
Expand All @@ -36,7 +38,8 @@ object Velocity : Module("Velocity", ModuleCategory.COMBAT) {
private val mode by ListValue(
"Mode", arrayOf(
"Simple", "AAC", "AACPush", "AACZero", "AACv4",
"Reverse", "SmoothReverse", "Jump", "Glitch", "Legit"
"Reverse", "SmoothReverse", "Jump", "Glitch", "Legit",
"GhostBlock"
), "Simple"
)

Expand All @@ -62,18 +65,29 @@ object Velocity : Module("Velocity", ModuleCategory.COMBAT) {

// Jump
private val jumpCooldownMode by ListValue("JumpCooldownMode", arrayOf("Ticks", "ReceivedHits"), "Ticks")
{ mode == "Jump" }
{ mode == "Jump" }
private val ticksUntilJump by IntegerValue("TicksUntilJump", 4, 0..20)
{ jumpCooldownMode == "Ticks" && mode == "Jump" }
{ jumpCooldownMode == "Ticks" && mode == "Jump" }
private val hitsUntilJump by IntegerValue("ReceivedHitsUntilJump", 2, 0..5)
{ jumpCooldownMode == "ReceivedHits" && mode == "Jump" }
{ jumpCooldownMode == "ReceivedHits" && mode == "Jump" }

// Ghost Block
private val maxHurtTime: IntegerValue = object : IntegerValue("MaxHurtTime", 9, 1..10) {
override fun isSupported() = mode == "GhostBlock"
override fun onChange(oldValue: Int, newValue: Int) = newValue.coerceAtLeast(minHurtTime.get())
}

private val minHurtTime: IntegerValue = object : IntegerValue("MinHurtTime", 1, 1..10) {
override fun isSupported() = mode == "GhostBlock" && !maxHurtTime.isMinimal()
override fun onChange(oldValue: Int, newValue: Int) = newValue.coerceIn(0, maxHurtTime.get())
}

// TODO: Could this be useful in other modes? (Jump?)
// Limits
private val limitMaxMotionValue = BoolValue("LimitMaxMotion", false) { mode == "Simple" }
private val maxXZMotion by FloatValue("MaxXZMotion", 0.4f, 0f..1.9f) { limitMaxMotionValue.isActive() }
private val maxYMotion by FloatValue("MaxYMotion", 0.36f, 0f..0.46f) { limitMaxMotionValue.isActive() }
//0.00075 is added silently
private val maxXZMotion by FloatValue("MaxXZMotion", 0.4f, 0f..1.9f) { limitMaxMotionValue.isActive() }
private val maxYMotion by FloatValue("MaxYMotion", 0.36f, 0f..0.46f) { limitMaxMotionValue.isActive() }
//0.00075 is added silently

// Vanilla XZ limits
// Non-KB: 0.4 (no sprint), 0.9 (sprint)
Expand Down Expand Up @@ -244,24 +258,15 @@ object Velocity : Module("Velocity", ModuleCategory.COMBAT) {
if (event.isCancelled)
return

if (
(
packet is S12PacketEntityVelocity
&& thePlayer.entityId == packet.entityID
&& packet.motionY > 0
&& (packet.motionX != 0 || packet.motionZ != 0)
) || (
packet is S27PacketExplosion
&& (thePlayer.motionY + packet.field_149153_g) > 0.0
&& ((thePlayer.motionX + packet.field_149152_f) != 0.0 || (thePlayer.motionZ + packet.field_149159_h) != 0.0)
)
) {
if ((packet is S12PacketEntityVelocity && thePlayer.entityId == packet.entityID && packet.motionY > 0 && (packet.motionX != 0 || packet.motionZ != 0))
|| (packet is S27PacketExplosion && (thePlayer.motionY + packet.field_149153_g) > 0.0
&& ((thePlayer.motionX + packet.field_149152_f) != 0.0 || (thePlayer.motionZ + packet.field_149159_h) != 0.0))) {
velocityTimer.reset()

when (mode.lowercase()) {
"simple" -> handleVelocity(event)

"aac", "reverse", "smoothreverse", "aaczero" -> hasReceivedVelocity = true
"aac", "reverse", "smoothreverse", "aaczero", "ghostblock" -> hasReceivedVelocity = true

"jump" -> {
// TODO: Recode and make all velocity modes support velocity direction checks
Expand All @@ -273,6 +278,7 @@ object Velocity : Module("Velocity", ModuleCategory.COMBAT) {

packetDirection = atan2(motionX, motionZ)
}

is S27PacketExplosion -> {
val motionX = thePlayer.motionX + packet.field_149152_f
val motionZ = thePlayer.motionZ + packet.field_149159_h
Expand All @@ -285,7 +291,7 @@ object Velocity : Module("Velocity", ModuleCategory.COMBAT) {
var angle = abs(degreePacket + degreePlayer)
val threshold = 120.0
angle = Math.floorMod(angle.toInt(), 360).toDouble()
val inRange = angle in 180-threshold/2..180+threshold/2
val inRange = angle in 180 - threshold / 2..180 + threshold / 2
if (inRange)
hasReceivedVelocity = true
}
Expand Down Expand Up @@ -341,6 +347,30 @@ object Velocity : Module("Velocity", ModuleCategory.COMBAT) {
}
}

@EventTarget
fun onBlockBB(event: BlockBBEvent) {
val player = mc.thePlayer ?: return

if (mode == "GhostBlock") {
if (hasReceivedVelocity) {
if (player.hurtTime in minHurtTime.get()..maxHurtTime.get()) {
// Check if there is air exactly 1 level above the player's Y position
if (event.block is BlockAir && event.y == mc.thePlayer.posY.toInt() + 1) {
event.boundingBox = AxisAlignedBB(event.x.toDouble(),
event.y.toDouble(),
event.z.toDouble(),
event.x + 1.0,
event.y + 1.0,
event.z + 1.0
)
}
} else if (player.hurtTime == 0) {
hasReceivedVelocity = false
}
}
}
}

private fun shouldJump() = when (jumpCooldownMode.lowercase()) {
"ticks" -> limitUntilJump >= ticksUntilJump
"receivedhits" -> limitUntilJump >= hitsUntilJump
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit

import net.ccbluex.liquidbounce.event.*
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.modules.exploit.disablermodes.startsprint.StartSprint
import net.ccbluex.liquidbounce.value.ListValue

object Disabler : Module("Disabler", ModuleCategory.EXPLOIT) {

private val disablerModes = arrayOf(
// Start Sprint
StartSprint
)

private val modes = disablerModes.map { it.modeName }.toTypedArray()

val mode by object : ListValue("Mode", modes, "StartSprint") {
override fun onChange(oldValue: String, newValue: String): String {
if (state)
onDisable()

return super.onChange(oldValue, newValue)
}

override fun onChanged(oldValue: String, newValue: String) {
if (state)
onEnable()
}
}

@EventTarget
fun onUpdate(event: UpdateEvent) {
modeModule.onUpdate()
}

@EventTarget
fun onMotion(event: MotionEvent) {
modeModule.onMotion()
}

@EventTarget
fun onTick(event: TickEvent) {
modeModule.onTick()
}

@EventTarget
fun onStrafe(event: StrafeEvent) {
modeModule.onStrafe()
}

override fun onEnable() {
modeModule.onEnable()
}

override fun onDisable() {
modeModule.onDisable()
}

override val tag
get() = mode

private val modeModule
get() = disablerModes.first { it.modeName == mode }

override fun handleEvents() = super.handleEvents() && mc.thePlayer != null && mc.theWorld != null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit.disablermodes

import net.ccbluex.liquidbounce.utils.MinecraftInstance

open class DisablerMode(val modeName: String) : MinecraftInstance() {
open fun onMotion() {}
open fun onUpdate() {}
open fun onTick() {}
open fun onStrafe() {}
open fun onEnable() {}
open fun onDisable() {}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit.disablermodes.startsprint

import net.ccbluex.liquidbounce.features.module.modules.exploit.disablermodes.DisablerMode

object StartSprint : DisablerMode("StartSprint")
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura;
import net.ccbluex.liquidbounce.features.module.modules.exploit.AntiHunger;
import net.ccbluex.liquidbounce.features.module.modules.exploit.Disabler;
import net.ccbluex.liquidbounce.features.module.modules.exploit.PortalMenu;
import net.ccbluex.liquidbounce.features.module.modules.fun.Derp;
import net.ccbluex.liquidbounce.features.module.modules.movement.InventoryMove;
Expand Down Expand Up @@ -128,7 +129,10 @@ private void onUpdateWalkingPlayer(CallbackInfo ci) {

final InventoryMove inventoryMove = InventoryMove.INSTANCE;
final Sneak sneak = Sneak.INSTANCE;
final boolean fakeSprint = (inventoryMove.handleEvents() && inventoryMove.getAacAdditionPro()) || AntiHunger.INSTANCE.handleEvents() || (sneak.handleEvents() && (!MovementUtils.INSTANCE.isMoving() || !sneak.getStopMove()) && sneak.getMode().equals("MineSecure"));
final boolean fakeSprint = inventoryMove.handleEvents() && inventoryMove.getAacAdditionPro()
|| AntiHunger.INSTANCE.handleEvents()
|| sneak.handleEvents() && (!MovementUtils.INSTANCE.isMoving() || !sneak.getStopMove()) && sneak.getMode().equals("MineSecure")
|| Disabler.INSTANCE.handleEvents() && Disabler.INSTANCE.getMode().equals("StartSprint");

boolean sprinting = isSprinting() && !fakeSprint;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@

"module.zoot.description": "Removes all bad potion effects/fire.",

"module.keepSprint.description": "Keeps you sprinting after attacking."
"module.keepSprint.description": "Keeps you sprinting after attacking.",

"module.disabler.description": "Disables either a server or a specific anticheat detection."
}
}

0 comments on commit 691aa63

Please sign in to comment.