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

Commit

Permalink
UNCPHop2 + refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Jan 25, 2024
1 parent 3a855e4 commit ae37c6b
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ object NoSlow : Module("NoSlow", ModuleCategory.MOVEMENT, gameDetecting = false)
( onlyMoveBow && mc.thePlayer.heldItem?.item is ItemBow ) )
) return

if (getIsUsingItem() || shouldSwap) {
if (isUsingItem || shouldSwap) {
when (mc.thePlayer.heldItem?.item) {
is ItemSword -> if (blocking) modeModuleBlocking.onMotion(event) else return
is ItemFood, is ItemPotion, is ItemBucketMilk -> if (consuming) modeModuleConsume.onMotion(event) else return
Expand All @@ -152,7 +152,7 @@ object NoSlow : Module("NoSlow", ModuleCategory.MOVEMENT, gameDetecting = false)
( onlyMoveBow && mc.thePlayer.heldItem?.item is ItemBow ) )
) return

if (getIsUsingItem() || shouldSwap) {
if (isUsingItem || shouldSwap) {
when (mc.thePlayer.heldItem?.item) {
is ItemSword -> if (blocking) modeModuleBlocking.onUpdate() else return
is ItemFood, is ItemPotion, is ItemBucketMilk -> if (consuming) modeModuleConsume.onUpdate() else return
Expand All @@ -163,7 +163,7 @@ object NoSlow : Module("NoSlow", ModuleCategory.MOVEMENT, gameDetecting = false)
@EventTarget
fun onPacket(event: PacketEvent) {
if (
( getIsUsingItem() || shouldSwap ) && ( mc.thePlayer.motionX != 0.0 || mc.thePlayer.motionZ != 0.0 ) && !(
( isUsingItem || shouldSwap ) && ( mc.thePlayer.motionX != 0.0 || mc.thePlayer.motionZ != 0.0 ) && !(
( onlyMoveConsume && isHoldingConsumable() ) ||
( onlyMoveBlocking && mc.thePlayer.heldItem?.item is ItemSword ) ||
( onlyMoveBow && mc.thePlayer.heldItem?.item is ItemBow )
Expand Down Expand Up @@ -210,6 +210,6 @@ object NoSlow : Module("NoSlow", ModuleCategory.MOVEMENT, gameDetecting = false)
else -> 0.2F
}
fun isUNCPBlocking() = modeModuleBlocking == UNCP && mc.gameSettings.keyBindUseItem.isKeyDown && (mc.thePlayer.heldItem?.item is ItemSword)
private fun getIsUsingItem() = mc.thePlayer?.heldItem != null && (mc.thePlayer.isUsingItem || (mc.thePlayer.heldItem?.item is ItemSword && KillAura.blockStatus) || isUNCPBlocking())
private val isUsingItem get() = mc.thePlayer?.heldItem != null && (mc.thePlayer.isUsingItem || (mc.thePlayer.heldItem?.item is ItemSword && KillAura.blockStatus) || isUNCPBlocking())
fun isHoldingConsumable() = mc.thePlayer.heldItem?.item is ItemFood || mc.thePlayer.heldItem?.item is ItemPotion || mc.thePlayer.heldItem?.item is ItemBucketMilk
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.modules.movement.nowebmodes.aac.*
import net.ccbluex.liquidbounce.features.module.modules.movement.nowebmodes.other.*
import net.ccbluex.liquidbounce.utils.extensions.resetSpeed
import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.ListValue
import net.ccbluex.liquidbounce.value.FloatValue
Expand Down Expand Up @@ -61,7 +62,7 @@ object NoWeb : Module("NoWeb", ModuleCategory.MOVEMENT) {
modeModule.onUpdate()
}
override fun onDisable() {
mc.timer.timerSpeed = 1.0F
mc.timer.resetSpeed()
}
override val tag
get() = mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.spar
import net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.spectre.*
import net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.verus.*
import net.ccbluex.liquidbounce.utils.MovementUtils.isMoving
import net.ccbluex.liquidbounce.utils.extensions.resetSpeed
import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.FloatValue
import net.ccbluex.liquidbounce.value.IntegerValue
Expand All @@ -32,6 +33,7 @@ object Speed : Module("Speed", ModuleCategory.MOVEMENT) {
NCPYPort,
UNCPHop,
UNCPYPort,
UNCPHop2,

// YPort
YPort,
Expand Down Expand Up @@ -182,19 +184,17 @@ object Speed : Module("Speed", ModuleCategory.MOVEMENT) {
}

override fun onEnable() {
if (mc.thePlayer == null)
return
mc.thePlayer ?: return

mc.timer.timerSpeed = 1f
mc.timer.resetSpeed()

modeModule.onEnable()
}

override fun onDisable() {
if (mc.thePlayer == null)
return
mc.thePlayer ?: return

mc.timer.timerSpeed = 1f
mc.timer.resetSpeed()

modeModule.onDisable()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.utils.MovementUtils.direction
import net.ccbluex.liquidbounce.utils.MovementUtils.isMoving
import net.ccbluex.liquidbounce.utils.block.BlockUtils.collideBlockIntersects
import net.ccbluex.liquidbounce.utils.extensions.resetSpeed
import net.ccbluex.liquidbounce.utils.extensions.stopXZ
import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.FloatValue
Expand Down Expand Up @@ -64,7 +65,7 @@ object Spider : Module("Spider", ModuleCategory.MOVEMENT) {

if (usedTimer) {
usedTimer = false
mc.timer.timerSpeed = 1f
mc.timer.resetSpeed()
}

when (mode) {
Expand Down Expand Up @@ -211,7 +212,7 @@ object Spider : Module("Spider", ModuleCategory.MOVEMENT) {
}

override fun onDisable() {
mc.timer.timerSpeed = 1f
mc.timer.resetSpeed()
usedTimer = false
}
private val isInsideBlock
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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.movement.speedmodes.ncp

import net.ccbluex.liquidbounce.event.MotionEvent
import net.ccbluex.liquidbounce.features.module.modules.movement.speedmodes.SpeedMode
import net.ccbluex.liquidbounce.utils.MovementUtils.strafe
import net.ccbluex.liquidbounce.utils.MovementUtils.isMoving
import net.ccbluex.liquidbounce.utils.extensions.jump
import net.ccbluex.liquidbounce.utils.extensions.stopXZ

object UNCPHop2 : SpeedMode("UNCPHop2") {
override fun onMotion(event: MotionEvent) {
if (!isMoving) {
mc.timer.timerSpeed = 1f
mc.thePlayer.stopXZ()
return
}

mc.timer.timerSpeed = 1.08f
strafe()
mc.thePlayer.jumpMovementFactor = 0.024f
mc.thePlayer.jump(0.39935305)
}

override fun onDisable() {
mc.thePlayer.jumpMovementFactor = 0.02f
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void jump() {
}

final Sprint sprint = Sprint.INSTANCE;
if (sprint.handleEvents() && sprint.getAllDirections() && sprint.getJumpDirections()) {
if (sprint.handleEvents() && sprint.getAllDirections() && sprint.getJumpDirections() && sprint.getMode().equals("Vanilla")) {
fixedYaw += MathExtensionsKt.toDegreesF(MovementUtils.INSTANCE.getDirection()) - this.rotationYaw;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,11 @@ fun EntityPlayerSP.sendUseItem(stack: ItemStack): Boolean {

true
} else false
}

fun EntityPlayer.jump(motion: Double = 0.42, ignoreGround: Boolean = false) {
if (ignoreGround || this.onGround) {
this.jump()
this.motionY = motion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* 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.utils.extensions

import net.minecraft.util.Timer

fun Timer.resetSpeed() {
this.timerSpeed = 1f
}

0 comments on commit ae37c6b

Please sign in to comment.