diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt index d138de858ae..bb455c30ff6 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/ModuleManager.kt @@ -205,6 +205,7 @@ object ModuleManager : Listenable { XRay, Zoot, KeepSprint, + Disabler ) InventoryManager.startCoroutine() diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Velocity.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Velocity.kt index c2b3b43dca2..e9203ff743d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Velocity.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/combat/Velocity.kt @@ -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 @@ -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" ) @@ -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) @@ -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 @@ -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 @@ -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 } @@ -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 diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/Disabler.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/Disabler.kt new file mode 100644 index 00000000000..e45cccf82f4 --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/Disabler.kt @@ -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 +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablermodes/DisablerMode.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablermodes/DisablerMode.kt new file mode 100644 index 00000000000..d71880ee25b --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablermodes/DisablerMode.kt @@ -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() {} + +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablermodes/startsprint/StartSprint.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablermodes/startsprint/StartSprint.kt new file mode 100644 index 00000000000..334c160986e --- /dev/null +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/exploit/disablermodes/startsprint/StartSprint.kt @@ -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") \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/entity/MixinEntityPlayerSP.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/entity/MixinEntityPlayerSP.java index e444e1959c7..b1b5d33ca0b 100644 --- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/entity/MixinEntityPlayerSP.java +++ b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/entity/MixinEntityPlayerSP.java @@ -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; @@ -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; diff --git a/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json b/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json index b24d930fe1d..1cc8e8dc81f 100644 --- a/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json +++ b/src/main/resources/assets/minecraft/liquidbounce/lang/en_US.json @@ -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." } }