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

Commit

Permalink
Port AACHop3.3.10 Speed From LiquidBouncePlusReborn
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Dec 5, 2023
1 parent 2f3b54f commit eb1b1bc
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ object Speed : Module("Speed", ModuleCategory.MOVEMENT) {
AAC5BHop,
AAC6BHop,
AAC7BHop,
AACHop3310,
AACHop3313,
AACHop350,
AACHop438,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* LiquidBounce+ Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/WYSI-Foundation/LiquidBouncePlus/
*/
package net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.aac

import net.ccbluex.liquidbounce.LiquidBounce
import net.ccbluex.liquidbounce.event.MoveEvent
import net.ccbluex.liquidbounce.event.PacketEvent
import net.ccbluex.liquidbounce.features.module.modules.movement.Speed
import net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.SpeedMode
import net.ccbluex.liquidbounce.utils.MovementUtils
import net.minecraft.client.settings.GameSettings
import net.minecraft.network.play.server.S12PacketEntityVelocity

object AACHop3310 : SpeedMode("AACHop3.3.10") {
override fun onMove(event: MoveEvent) {
val player = mc.thePlayer
mc.gameSettings.keyBindJump.pressed = false
MovementUtils.strafe((MovementUtils.getBaseMoveSpeed() * 1.0164f).toFloat())
if (mc.thePlayer.onGround && mc.thePlayer.isCollidedVertically && GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) {
player.motionY = MovementUtils.getJumpBoostModifier(0.41999998688697815)
event.y = player.motionY
}
if (mc.thePlayer.onGround && mc.thePlayer.isCollidedVertically && !GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) {
player.motionY = MovementUtils.getJumpBoostModifier(0.41999998688697815)
event.y = player.motionY
}
}

fun onPacket(event: PacketEvent) {
if (event.packet is S12PacketEntityVelocity) {
if (mc.thePlayer.onGround && mc.thePlayer.isSneaking && MovementUtils.isMoving) return
event.cancelEvent()
}
}
}
36 changes: 35 additions & 1 deletion src/main/java/net/ccbluex/liquidbounce/utils/MovementUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import net.ccbluex.liquidbounce.event.MoveEvent
import net.ccbluex.liquidbounce.event.PacketEvent
import net.ccbluex.liquidbounce.utils.extensions.stopXZ
import net.ccbluex.liquidbounce.utils.extensions.toRadiansD
import net.minecraft.block.BlockIce
import net.minecraft.block.BlockPackedIce
import net.minecraft.network.play.client.C03PacketPlayer
import net.minecraft.potion.Potion
import net.minecraft.util.BlockPos
import kotlin.math.cos
import kotlin.math.sin
import kotlin.math.sqrt
Expand All @@ -21,7 +25,37 @@ object MovementUtils : MinecraftInstance(), Listenable {
var speed
get() = mc.thePlayer?.run { sqrt(motionX * motionX + motionZ * motionZ).toFloat() } ?: .0f
set(value) { strafe(value) }

fun isOnIce(): Boolean {
val thePlayer = mc.thePlayer
val blockUnder = mc.theWorld.getBlockState(BlockPos(thePlayer.posX, thePlayer.posY - 1.0, thePlayer.posZ)).block
return blockUnder is BlockIce || blockUnder is BlockPackedIce
}
fun getBaseMoveSpeed(): Double {
var baseSpeed = 0.2873
if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {
baseSpeed *= 1.0 + 0.2 * (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).amplifier + 1).toDouble()
}
return baseSpeed
}
fun getBaseMoveSpeed(customSpeed: Double): Double {
var baseSpeed = if (MovementUtils.isOnIce()) 0.258977700006 else customSpeed
if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) {
val amplifier = mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).amplifier
baseSpeed *= 1.0 + 0.2 * (amplifier + 1)
}
return baseSpeed
}
fun getJumpBoostModifier(baseJumpHeight: Double): Double {
return getJumpBoostModifier(baseJumpHeight, true)
}
fun getJumpBoostModifier(baseJumpHeight: Double, potionJump: Boolean): Double {
var baseJumpHeight = baseJumpHeight
if (mc.thePlayer.isPotionActive(Potion.jump) && potionJump) {
val amplifier = mc.thePlayer.getActivePotionEffect(Potion.jump).amplifier
baseJumpHeight += ((amplifier + 1).toFloat() * 0.1f).toDouble()
}
return baseJumpHeight
}
val isMoving
get() = mc.thePlayer?.movementInput?.run { moveForward != 0f || moveStrafe != 0f } ?: false

Expand Down

0 comments on commit eb1b1bc

Please sign in to comment.