Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
vanilla -> custom
Browse files Browse the repository at this point in the history
and new vanilla velo
  • Loading branch information
ManInMyVan committed Jan 9, 2024
1 parent c94b063 commit 5843bee
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import net.minecraft.network.play.server.S12PacketEntityVelocity

object Velocity : Module("Velocity", ModuleCategory.COMBAT) {
private val velocityModes = arrayOf(
Custom,
Vanilla,
Phase,
Vulcan,
Expand All @@ -38,7 +39,7 @@ object Velocity : Module("Velocity", ModuleCategory.COMBAT) {
Motion Limits
Only Combat
Direction Override
Delayed setting in Vanilla
Delayed setting in Custom
*/

// Settings
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package net.ccbluex.liquidbounce.features.module.modules.combat.velocitymodes.other

import net.ccbluex.liquidbounce.event.PacketEvent
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.attackReduce
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.attackReduceMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.cancelHorizontal
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.cancelVertical
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.chance
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.horizontalMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.jump
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.jumpFailRate
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.jumpMotion
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverse
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseNoGround
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseSmooth
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseStrength
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseTicks
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduce
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceHorizontal
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceTicks
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceVertical
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.velocityTick
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.verticalMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.velocitymodes.VelocityMode
import net.ccbluex.liquidbounce.utils.MovementUtils.speed
import net.minecraft.network.play.server.S12PacketEntityVelocity
import net.ccbluex.liquidbounce.utils.misc.RandomUtils

object Custom : VelocityMode("Custom") {
override fun onVelocityPacket(event: PacketEvent) {
val packet = event.packet
if (packet !is S12PacketEntityVelocity) return
if (RandomUtils.nextInt(1, 100) <= chance) {

packet.motionX = (packet.getMotionX() * horizontalMultiplier).toInt()
packet.motionY = (packet.getMotionY() * verticalMultiplier).toInt()
packet.motionZ = (packet.getMotionZ() * horizontalMultiplier).toInt()

event.cancelEvent()

if (!cancelVertical) mc.thePlayer.motionY = packet.getMotionY().toDouble() / 8000.0
if (!cancelHorizontal) {
mc.thePlayer.motionX = packet.getMotionX().toDouble() / 8000.0
mc.thePlayer.motionZ = packet.getMotionZ().toDouble() / 8000.0
}
}
}

override fun onUpdate() {
if (!mc.thePlayer.isJumping && jump && mc.thePlayer.onGround && mc.thePlayer.hurtTime == 9 && RandomUtils.nextInt(1, 100) > jumpFailRate) {
mc.thePlayer.jump()
mc.thePlayer.motionY = jumpMotion.toDouble()
}
if (reverse && !(reverseNoGround && mc.thePlayer.onGround)) {
if (reverseTicks > velocityTick) {
if (reverseSmooth) mc.thePlayer.speedInAir = reverseStrength
else speed *= reverseStrength
} else if (reverseSmooth) mc.thePlayer.speedInAir = 0.02f
}
if (tickreduce && tickreduceTicks == velocityTick) {
if (tickreduceVertical) mc.thePlayer.motionY *= tickreduceMultiplier
if (tickreduceHorizontal) {
mc.thePlayer.motionX *= tickreduceMultiplier
mc.thePlayer.motionZ *= tickreduceMultiplier
}
}
}

override fun onAttack() {
if (mc.thePlayer.hurtTime < 3 || !attackReduce) return
mc.thePlayer.motionX *= attackReduceMultiplier.toDouble()
mc.thePlayer.motionZ *= attackReduceMultiplier.toDouble()
}
}
Original file line number Diff line number Diff line change
@@ -1,75 +1,10 @@
package net.ccbluex.liquidbounce.features.module.modules.combat.velocitymodes.other

import net.ccbluex.liquidbounce.event.PacketEvent
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.attackReduce
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.attackReduceMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.cancelHorizontal
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.cancelVertical
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.chance
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.horizontalMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.jump
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.jumpFailRate
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.jumpMotion
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverse
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseNoGround
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseSmooth
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseStrength
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.reverseTicks
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduce
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceHorizontal
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceTicks
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.tickreduceVertical
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.velocityTick
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity.verticalMultiplier
import net.ccbluex.liquidbounce.features.module.modules.combat.velocitymodes.VelocityMode
import net.ccbluex.liquidbounce.utils.MovementUtils.speed
import net.minecraft.network.play.server.S12PacketEntityVelocity
import net.ccbluex.liquidbounce.utils.misc.RandomUtils

object Vanilla : VelocityMode("Vanilla") {
override fun onVelocityPacket(event: PacketEvent) {
val packet = event.packet
if (packet !is S12PacketEntityVelocity) return
if (RandomUtils.nextInt(1, 100) <= chance) {

packet.motionX = (packet.getMotionX() * horizontalMultiplier).toInt()
packet.motionY = (packet.getMotionY() * verticalMultiplier).toInt()
packet.motionZ = (packet.getMotionZ() * horizontalMultiplier).toInt()

event.cancelEvent()

if (!cancelVertical) mc.thePlayer.motionY = packet.getMotionY().toDouble() / 8000.0
if (!cancelHorizontal) {
mc.thePlayer.motionX = packet.getMotionX().toDouble() / 8000.0
mc.thePlayer.motionZ = packet.getMotionZ().toDouble() / 8000.0
}
}
}

override fun onUpdate() {
if (!mc.thePlayer.isJumping && jump && mc.thePlayer.onGround && mc.thePlayer.hurtTime == 9 && RandomUtils.nextInt(1, 100) > jumpFailRate) {
mc.thePlayer.jump()
mc.thePlayer.motionY = jumpMotion.toDouble()
}
if (reverse && !(reverseNoGround && mc.thePlayer.onGround)) {
if (reverseTicks > velocityTick) {
if (reverseSmooth) mc.thePlayer.speedInAir = reverseStrength
else speed *= reverseStrength
} else if (reverseSmooth) mc.thePlayer.speedInAir = 0.02f
}
if (tickreduce && tickreduceTicks == velocityTick) {
if (tickreduceVertical) mc.thePlayer.motionY *= tickreduceMultiplier
if (tickreduceHorizontal) {
mc.thePlayer.motionX *= tickreduceMultiplier
mc.thePlayer.motionZ *= tickreduceMultiplier
}
}
}

override fun onAttack() {
if (mc.thePlayer.hurtTime < 3 || !attackReduce) return
mc.thePlayer.motionX *= attackReduceMultiplier.toDouble()
mc.thePlayer.motionZ *= attackReduceMultiplier.toDouble()
event.cancelEvent()
}
}
}

0 comments on commit 5843bee

Please sign in to comment.