Skip to content

Commit

Permalink
RightClick Fix when ViaVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
XeContrast committed Nov 17, 2024
1 parent 44976e0 commit d87b75a
Show file tree
Hide file tree
Showing 10 changed files with 256 additions and 198 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ processResources {

rename "(.+_at.cfg)", "META-INF/\$1"
}
1L

task moveResources {
doLast {
ant.move file: "${buildDir}/resources/main",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import kotlin.math.abs
import kotlin.math.atan2
import kotlin.math.floor
import kotlin.math.sqrt
//

@ModuleInfo(name = "Velocity", category = ModuleCategory.COMBAT)
object Velocity : Module() {
private val mainMode =
Expand Down Expand Up @@ -924,18 +924,17 @@ object Velocity : Module() {
"grimac" -> {
when (grimMode.get().lowercase()) {
"grimreduce" -> {
if (unReduceTimes > 0 && mc.thePlayer.hurtTime > 0 && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mc.objectMouseOver.entityHit is EntityPlayer) {
val objectMouseOver = mc.objectMouseOver ?: return
if (unReduceTimes > 0 && mc.thePlayer.hurtTime > 0 && objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && objectMouseOver.entityHit is EntityPlayer) {
if (!mc.thePlayer.serverSprintState) {
PacketUtils.sendPacket(C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING))
mc.thePlayer.serverSprintState = true
mc.thePlayer.isSprinting = true
}

for (i in 0 until reduceCount.get()) {
PacketUtils.sendPackets(
C0APacketAnimation(),
C02PacketUseEntity(mc.objectMouseOver.entityHit,C02PacketUseEntity.Action.ATTACK)
)
mc.thePlayer.swingItem()
PacketUtils.sendPacket(C02PacketUseEntity(mc.objectMouseOver.entityHit,C02PacketUseEntity.Action.ATTACK))

mc.thePlayer.motionX *= 0.6
mc.thePlayer.motionZ *= 0.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,9 @@
*/
package net.ccbluex.liquidbounce.features.module.modules.exploit

import net.ccbluex.liquidbounce.FDPClient
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.ModuleInfo
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.NotifyType

@ModuleInfo(name = "ViaVersionFix", category = ModuleCategory.EXPLOIT)
class ViaVersionFix : Module() {
override fun onEnable() {
FDPClient.hud.addNotification(
Notification(
"WARNING",
"If you using this module in a low version server < 1.12.Server AntiCheat will detect this as a hack when you right click!",
NotifyType.WARNING,
4000,
500
)
)
}
}
class ViaVersionFix : Module()
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ object NoSlow : Module() {
private var start = false
private var stop = false
private var mstimer2 = MSTimer()

private var shouldNoSlow = false

private var hasDropped = false
//hypixel
private var postPlace = false
//UNCP
Expand Down Expand Up @@ -254,23 +258,6 @@ object NoSlow : Module() {
}
}

"bug" -> {
if (mc.thePlayer.heldItem.item is ItemPotion || mc.thePlayer.heldItem.item is ItemBucketMilk || mc.thePlayer.heldItem.stackSize <= 1) {
return
}
mc.thePlayer.sendQueue.addToSendQueue(
C07PacketPlayerDigging(
C07PacketPlayerDigging.Action.DROP_ITEM,
BlockPos(0, 0, 0),
EnumFacing.DOWN
)
)

mc.gameSettings.keyBindUseItem.pressed = false
mc.thePlayer.stopUsingItem()
mstimer2.reset()
}

"spamitemchange" -> {
mc.netHandler.addToSendQueue(C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem))
}
Expand Down Expand Up @@ -554,8 +541,10 @@ object NoSlow : Module() {
return
val heldItem = mc.thePlayer.heldItem?.item

event.forward = getMultiplier(heldItem, true)
event.strafe = getMultiplier(heldItem, false)
if (!consumePacketValue.equals("Bug") || shouldNoSlow) {
event.forward = getMultiplier(heldItem, true)
event.strafe = getMultiplier(heldItem, false)
}
}

private fun getMultiplier(item: Item?, isForward: Boolean) = when (item) {
Expand Down Expand Up @@ -655,8 +644,37 @@ object NoSlow : Module() {
fun onPacket(event: PacketEvent) {
if (mc.thePlayer == null || mc.theWorld == null || (onlyGround.get() && !mc.thePlayer.onGround))
return

val packet = event.packet
val heldItem = mc.thePlayer.heldItem?.item
val heldItem = mc.thePlayer.heldItem.item ?: return

if (consumePacketValue.equals("Bug")) {
if (mc.thePlayer.heldItem?.item !is ItemFood) return

val isUsingItem = packet is C08PacketPlayerBlockPlacement && packet.placedBlockDirection == 255

if (!mc.thePlayer.isUsingItem) {
shouldNoSlow = false
hasDropped = false
}

if (isUsingItem && !hasDropped) {
PacketUtils.sendPacket(C07PacketPlayerDigging(C07PacketPlayerDigging.Action.DROP_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN))
shouldNoSlow = false
hasDropped = true
} else if (packet is S2FPacketSetSlot && mc.thePlayer.isUsingItem) {
if (packet.func_149175_c() != 0) return

event.cancelEvent()
shouldNoSlow = true

mc.thePlayer.itemInUse = packet.func_149174_e()
if (!mc.thePlayer.isUsingItem) mc.thePlayer.itemInUseCount = 0
}
mc.thePlayer.stopUsingItem()
mc.gameSettings.keyBindUseItem.pressed = false

}

stop = packet is C07PacketPlayerDigging && packet.status == (C07PacketPlayerDigging.Action.RELEASE_USE_ITEM)
if (consumeModifyValue.get() && mc.thePlayer.isUsingItem && (heldItem is ItemFood || heldItem is ItemPotion || heldItem is ItemBucketMilk)) {
Expand Down Expand Up @@ -710,6 +728,7 @@ object NoSlow : Module() {
}
}


if ((modeValue.equals("Matrix") || modeValue.equals("GrimAC")) && nextTemp) {
if ((packet is C07PacketPlayerDigging || packet is C08PacketPlayerBlockPlacement) && isBlocking) {
event.cancelEvent()
Expand Down
Loading

0 comments on commit d87b75a

Please sign in to comment.