Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Hypixel motion disabler + lowhop #3816

Merged
merged 8 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public abstract class MixinClientPlayerEntity extends MixinPlayerEntity {
@Unique
private PlayerData lastKnownStatistics = null;

@Unique
private PlayerNetworkMovementTickEvent eventMotion;

/**
* Hook entity tick event
*/
Expand Down Expand Up @@ -116,15 +119,38 @@ private void hookMovementTickEvent(CallbackInfo callbackInfo) {
*/
@Inject(method = "sendMovementPackets", at = @At("HEAD"))
private void hookMovementPre(CallbackInfo callbackInfo) {
EventManager.INSTANCE.callEvent(new PlayerNetworkMovementTickEvent(EventState.PRE));
ClientPlayerEntity player = (ClientPlayerEntity) (Object) this;
eventMotion = new PlayerNetworkMovementTickEvent(EventState.PRE, player.getX(), player.getY(), player.getZ(), player.isOnGround());
EventManager.INSTANCE.callEvent(eventMotion);
}

@ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getX()D"))
private double modifyXPosition(double original) {
return eventMotion.getX();
}

@ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getY()D"))
private double modifyYPosition(double original) {
return eventMotion.getY();
}

@ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getZ()D"))
private double modifyZPosition(double original) {
return eventMotion.getZ();
}

@ModifyExpressionValue(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isOnGround()Z"))
private boolean modifyOnGround(boolean original) {
return eventMotion.getGround();
}

/**
* Hook entity movement tick event at RETURN and call out POST tick movement event
*/
@Inject(method = "sendMovementPackets", at = @At("RETURN"))
private void hookMovementPost(CallbackInfo callbackInfo) {
EventManager.INSTANCE.callEvent(new PlayerNetworkMovementTickEvent(EventState.POST));
ClientPlayerEntity player = (ClientPlayerEntity) (Object) this;
EventManager.INSTANCE.callEvent(new PlayerNetworkMovementTickEvent(EventState.POST, player.getX(), player.getY(), player.getZ(), player.isOnGround()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ class PlayerPostTickEvent : Event()
class PlayerMovementTickEvent : Event()

@Nameable("playerNetworkMovementTick")
class PlayerNetworkMovementTickEvent(val state: EventState) : Event()
class PlayerNetworkMovementTickEvent(val state: EventState,
var x: Double,
var y: Double,
var z: Double,
var ground: Boolean
): Event()

@Nameable("playerPushOut")
class PlayerPushOutEvent : CancellableEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ object ModuleDisabler : Module("Disabler", Category.EXPLOIT) {
tree(DisablerVerusCombat)
tree(DisablerVerusExperimental)
tree(DisablerVerusScaffoldG)
tree(DisablerHypixel)
}

override fun enable() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2024 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.exploit.disabler.disablers

import net.ccbluex.liquidbounce.config.ToggleableConfigurable
import net.ccbluex.liquidbounce.event.EventState
import net.ccbluex.liquidbounce.event.events.*
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.features.module.modules.exploit.disabler.ModuleDisabler
import net.minecraft.network.packet.s2c.play.*

internal object DisablerHypixel : ToggleableConfigurable(ModuleDisabler, "Hypixel", false) {
private var ticks = 0
private var airTicks = 0
private var disabled = false
private var jump = false

@Suppress("unused")
private val packetHandler = handler<PacketEvent> { event ->
val packet = event.packet

if (packet is PlayerRespawnS2CPacket) {
ticks = 0
disabled = false
jump = true
}

if (packet is PlayerPositionLookS2CPacket) {
ticks++
if(ticks == 25) {
disabled = false
ticks = 0
}
}
}

@Suppress("unused")
private val onNetworkTick = handler<PlayerNetworkMovementTickEvent> { event ->
if (event.state != EventState.PRE) return@handler
if (player.isOnGround) airTicks = 0 else airTicks++

if (player.isOnGround && jump) {
player.jump()
jump = false
disabled = true
}

if (disabled && airTicks >= 10) {
if(airTicks % 2 == 0) {
event.x += 0.095
}
player.setVelocity(0.0, 0.0, 0.0)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,28 @@ package net.ccbluex.liquidbounce.features.module.modules.movement.speed.modes.wa
import net.ccbluex.liquidbounce.config.Choice
import net.ccbluex.liquidbounce.config.ChoiceConfigurable
import net.ccbluex.liquidbounce.event.events.MovementInputEvent
import net.ccbluex.liquidbounce.event.events.PacketEvent
import net.ccbluex.liquidbounce.event.events.PlayerJumpEvent
import net.ccbluex.liquidbounce.event.handler
import net.ccbluex.liquidbounce.event.repeatable
import net.ccbluex.liquidbounce.event.sequenceHandler
import net.ccbluex.liquidbounce.features.module.modules.movement.speed.ModuleSpeed
import net.ccbluex.liquidbounce.features.module.modules.player.ModuleBlink
import net.ccbluex.liquidbounce.features.module.modules.player.nofall.ModuleNoFall
import net.ccbluex.liquidbounce.features.module.modules.world.scaffold.ModuleScaffold
import net.ccbluex.liquidbounce.utils.client.Timer
import net.ccbluex.liquidbounce.utils.entity.moving
import net.ccbluex.liquidbounce.utils.entity.sqrtSpeed
import net.ccbluex.liquidbounce.utils.entity.strafe
import net.ccbluex.liquidbounce.utils.kotlin.Priority
import net.minecraft.entity.effect.StatusEffects
import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket

/**
* @anticheat Watchdog (NCP)
* @anticheatVersion 12.12.2023
* @anticheatVersion 28.8.2024
* @testedOn hypixel.net
*/
class SpeedHypixelBHop(override val parent: ChoiceConfigurable<*>) : Choice("HypixelBHop") {

private val horizontalAcceleration by boolean("HorizontalAcceleration", true)
private val verticalAcceleration by boolean("VerticalAcceleration", true)

companion object {

private const val BASE_HORIZONTAL_MODIFIER = 0.0004

// todo: check if we can do more with this
private const val HORIZONTAL_SPEED_AMPLIFIER = 0.0007
private const val VERTICAL_SPEED_AMPLIFIER = 0.0004

/**
* Vanilla maximum speed
* w/o: 0.2857671997172534
Expand All @@ -63,35 +54,26 @@ class SpeedHypixelBHop(override val parent: ChoiceConfigurable<*>) : Choice("Hyp
* Speed mod: 0.008003278196411223
*/
private const val AT_LEAST = 0.281
private const val BASH = 0.2857671997172534
private const val SPEED_EFFECT_CONST = 0.008003278196411223
private const val SPEED_EFFECT_CONST = 0.13

}

private var wasFlagged = false
private var airTicks = 0

val repeatable = repeatable {
if (player.isOnGround) {
// Strafe when on ground
player.strafe()
airTicks = 0
return@repeatable
} else {
// Not much speed boost, but still a little bit - if someone wants to improve this, feel free to do so
val horizontalMod = if (horizontalAcceleration) {
BASE_HORIZONTAL_MODIFIER + HORIZONTAL_SPEED_AMPLIFIER *
(player.getStatusEffect(StatusEffects.SPEED)?.amplifier ?: 0)
} else {
0.0
airTicks++
if (airTicks == 1) {
player.strafe(strength = 1.0)
}

// Vertical acceleration, this makes sense to get a little bit more speed again
val yMod = if (verticalAcceleration && player.velocity.y < 0 && player.fallDistance < 1) {
VERTICAL_SPEED_AMPLIFIER
} else {
0.0
if(airTicks == 5) {
player.velocity.y = -0.1523351824467155
}

player.velocity = player.velocity.multiply(1.0 + horizontalMod, 1.0 + yMod, 1.0 + horizontalMod)
}
}

Expand All @@ -102,7 +84,7 @@ class SpeedHypixelBHop(override val parent: ChoiceConfigurable<*>) : Choice("Hyp
0.0
}

player.strafe(speed = player.sqrtSpeed.coerceAtLeast(atLeast))
player.strafe(speed = player.sqrtSpeed.coerceAtLeast(atLeast) - 0.002)
}

val moveHandler = handler<MovementInputEvent> {
Expand All @@ -116,32 +98,9 @@ class SpeedHypixelBHop(override val parent: ChoiceConfigurable<*>) : Choice("Hyp
it.jumping = true
}

val packetHandler = sequenceHandler<PacketEvent> {
val packet = it.packet

if (packet is EntityVelocityUpdateS2CPacket && packet.entityId == player.id) {
val velocityX = packet.velocityX / 8000.0
val velocityY = packet.velocityY / 8000.0
val velocityZ = packet.velocityZ / 8000.0

waitTicks(1)

// Fall damage velocity
val speed = if (velocityX == 0.0 && velocityZ == 0.0 && velocityY == -0.078375) {
player.sqrtSpeed.coerceAtLeast(
BASH *
(player.getStatusEffect(StatusEffects.SPEED)?.amplifier ?: 0))
} else {
player.sqrtSpeed
}
player.strafe(speed = speed)
} else if (packet is PlayerPositionLookS2CPacket) {
wasFlagged = true
}
}

override fun disable() {
wasFlagged = false
airTicks = 0
}

}
Loading