Skip to content

Commit

Permalink
Small Update
Browse files Browse the repository at this point in the history
  • Loading branch information
XeContrast committed Dec 22, 2024
1 parent 7e67aaa commit 6364f38
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import net.ccbluex.liquidbounce.features.value.ColorSettingsInteger
import net.ccbluex.liquidbounce.features.value.FloatValue
import net.ccbluex.liquidbounce.features.value.ListValue
import net.ccbluex.liquidbounce.injection.implementations.IMixinEntity
import net.ccbluex.liquidbounce.utils.EntityUtils.isSelected
import net.ccbluex.liquidbounce.utils.extensions.*
import net.ccbluex.liquidbounce.utils.interpolatedPosition
import net.ccbluex.liquidbounce.utils.lerpWith
Expand Down Expand Up @@ -48,7 +49,7 @@ object ForwardTrack : Module() {
* Any good anti-cheat will easily detect this module.
*/
fun includeEntityTruePos(entity: Entity, action: () -> Unit) {
if (!handleEvents() || entity !is EntityLivingBase || entity is EntityPlayerSP)
if (!handleEvents() || !isSelected(entity, true))
return

// Would be more fun if we simulated instead.
Expand Down Expand Up @@ -77,9 +78,9 @@ object ForwardTrack : Module() {

val renderManager = mc.renderManager

for (target in world.loadedEntityList) {
if (target is EntityPlayerSP)
continue
world.loadedEntityList.asSequence()
.filter { isSelected(it, true) }
.forEach { target ->

target?.run {
val vec = usePosition(this)
Expand All @@ -95,6 +96,7 @@ object ForwardTrack : Module() {

"model" -> {
glPushMatrix()
glPushAttrib(GL_ALL_ATTRIB_BITS)

color(0.6f, 0.6f, 0.6f, 1f)
renderManager.doRenderEntity(
Expand All @@ -105,6 +107,7 @@ object ForwardTrack : Module() {
true
)

glPopAttrib()
glPopMatrix()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ object KillAura : Module() {

private val attackTimingValue =
ListValue("AttackTiming", arrayOf("All", "Pre", "Post"), "All").displayable { attackDisplay.get() }
val sprintmode = ListValue("SprintMode", arrayOf("KeepSprint","Ground","StopSprint","StopMotion"),"KeepSprint").displayable { attackDisplay.get() }

private val hitselectValue = BoolValue("HitSelect", false).displayable { attackDisplay.get() }
private val hitselectRangeValue = FloatValue(
Expand Down Expand Up @@ -420,7 +419,6 @@ object KillAura : Module() {
private val noEat = BoolValue("NoEat", false).displayable { toolsDisplay.get() }
private val noBlocking = BoolValue("NoBlocking", false).displayable { toolsDisplay.get() }
private val noBadPacketsValue = BoolValue("NoBadPackets", false).displayable { toolsDisplay.get() }
private val jumpFixValue = BoolValue("JumpFix", false).displayable { toolsDisplay.get() }
private val noInventoryAttackValue =
ListValue("NoInvAttack", arrayOf("Spoof", "CancelRun", "Off"), "Off").displayable { toolsDisplay.get() }
private val noInventoryDelayValue = IntegerValue(
Expand Down Expand Up @@ -809,9 +807,19 @@ object KillAura : Module() {

@EventTarget
fun onStrafe(event: StrafeEvent) {
if (currentTarget != null && RotationUtils.targetRotation != null) {
if (rotationStrafeValue.equals("Vanilla")) {
val (yaw) = RotationUtils.targetRotation ?: return
if (rotationStrafeValue.equals("Vanilla")) {
targetRotation?.let {
val (yaw) = it
event.yaw = yaw
}
}
}

@EventTarget
fun onJump(event: JumpEvent) {
if (rotationStrafeValue.equals("Vanilla")) {
targetRotation?.let {
val (yaw) = it
event.yaw = yaw
}
}
Expand Down Expand Up @@ -964,7 +972,7 @@ object KillAura : Module() {
// Attack
if (!targetModeValue.equals("Multi")) {
attackEntity(if (raycastValue.get()) {
(RaycastUtils.raycastEntity(maxRange.toDouble()) {
(raycastEntity(maxRange.toDouble()) {
it is EntityLivingBase && it !is EntityArmorStand && (!raycastTargetValue.get() || EntityUtils.canRayCast(
it
)) && !EntityUtils.isFriend(it)
Expand Down Expand Up @@ -1129,10 +1137,7 @@ object KillAura : Module() {
// Attack target
runSwing()
packetSent = true
mc.netHandler.addToSendQueue(C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK))


swingKeepSprint(entity)
mc.playerController.attackEntity(mc.thePlayer,entity)

postAttack(entity)

Expand Down Expand Up @@ -1175,38 +1180,6 @@ object KillAura : Module() {
}
}

private fun swingKeepSprint(entity: EntityLivingBase) {
when (sprintmode.get().lowercase()) {
"keepsprint" -> {
if (!FDPClient.moduleManager[KeepSprint::class.java]!!.state) {
val thePlayer = mc.thePlayer
if (thePlayer.fallDistance > 0F && !thePlayer.onGround && !thePlayer.isOnLadder && !thePlayer.isInWater && !thePlayer.isPotionActive(
Potion.blindness
) && !thePlayer.isRiding
) {
thePlayer.onCriticalHit(entity)
}

// Enchant Effect
if (EnchantmentHelper.getModifierForCreature(thePlayer.heldItem, entity.creatureAttribute) > 0F) {
thePlayer.onEnchantmentCritical(entity)
}
}
}
"stopmotion" -> {
if (mc.playerController.currentGameType != WorldSettings.GameType.SPECTATOR) {
PlayerUtils.attackTargetEntityWithCurrentItem(entity)
}
}
"stopsprint" -> mc.thePlayer.serverSprintState = false
"attackslow" -> {
if (mc.playerController.currentGameType != WorldSettings.GameType.SPECTATOR) {
mc.thePlayer.attackTargetEntityWithCurrentItem(entity)
}
}
}
}

/**
* Update killaura rotations to enemy
*/
Expand Down Expand Up @@ -1270,7 +1243,7 @@ object KillAura : Module() {
"Quad" -> (diffAngle / 360.0).pow(2.0) * maxTurnSpeedValue.get() + (1 - (diffAngle / 360.0).pow(2.0)) * minTurnSpeedValue.get()
"Sine" -> (-cos(diffAngle / 180 * Math.PI) * 0.5 + 0.5) * maxTurnSpeedValue.get() + (cos(diffAngle / 360 * Math.PI) * 0.5 + 0.5) * minTurnSpeedValue.get()
"QuadSine" -> (-cos(diffAngle / 180 * Math.PI) * 0.5 + 0.5).pow(2.0) * maxTurnSpeedValue.get() + (1 - (-cos(
diffAngle / 180 * Math.PI
diffAngle.toDegrees()
) * 0.5 + 0.5).pow(2.0)) * minTurnSpeedValue.get()

else -> 360.0
Expand All @@ -1290,7 +1263,7 @@ object KillAura : Module() {
"LockView" -> RotationUtils.limitAngleChange(
RotationUtils.serverRotation!!,
directRotation,
(180.0).toFloat()
180.0F
)

"SmoothCenter", "SmoothLiquid", "SmoothCustom" -> RotationUtils.limitAngleChange(
Expand Down Expand Up @@ -1464,20 +1437,19 @@ object KillAura : Module() {
return
}

val player = mc.thePlayer ?: return

if (interact) {
val positionEye = mc.renderViewEntity?.getPositionEyes(1F)

interactEntity.collisionBorderSize.toDouble()
val boundingBox = interactEntity.hitBox

val (yaw, pitch) = RotationUtils.targetRotation ?: Rotation(
mc.thePlayer!!.rotationYaw,
mc.thePlayer!!.rotationPitch
)
val yawCos = cos(-yaw * 0.017453292F - Math.PI.toFloat())
val yawSin = sin(-yaw * 0.017453292F - Math.PI.toFloat())
val pitchCos = -cos(-pitch * 0.017453292F)
val pitchSin = sin(-pitch * 0.017453292F)
val (yaw, pitch) = targetRotation ?: player.rotation
val yawCos = cos(-yaw.toRadians() - Math.PI.toFloat())
val yawSin = sin(-yaw.toRadians() - Math.PI.toFloat())
val pitchCos = -cos(-pitch.toRadians())
val pitchSin = sin(-pitch.toRadians())
val range = min(maxRange.toDouble(), mc.thePlayer!!.getDistanceToEntityBox(interactEntity)) + 1
val lookAt =
positionEye!!.addVector(yawSin * pitchCos * range, pitchSin * range, yawCos * pitchCos * range)
Expand Down Expand Up @@ -1556,50 +1528,41 @@ object KillAura : Module() {
discoveredTargets.clear()
inRangeDiscoveredTargets.clear()
}
if (currentTarget != null && attackTimer.hasTimePassed(attackDelay) && currentTarget!!.hurtTime <= hurtTimeValue.get()) {
clicks++
attackTimer.reset()
attackDelay = getAttackDelay(minCpsValue.get(), maxCpsValue.get())
}

if (currentTarget != null && attackTimer.hasTimePassed((attackDelay.toDouble() * 0.9).toLong()) && (autoBlockValue.equals(
"Range"
) && canBlock) && autoBlockPacketValue.equals("KeyBlock")
) {
mc.gameSettings.keyBindUseItem.pressed = false
}

if (currentTarget != null && delayBlockTimer.hasTimePassed(30) && (autoBlockValue.equals("Range") && canBlock)) {
if (autoBlockPacketValue.equals("KeyBlock")) {
mc.gameSettings.keyBindUseItem.pressed = true
currentTarget?.let {
if (attackTimer.hasTimePassed(attackDelay) && currentTarget!!.hurtTime <= hurtTimeValue.get()) {
clicks++
attackTimer.reset()
attackDelay = getAttackDelay(minCpsValue.get(), maxCpsValue.get())
}
if (autoBlockPacketValue.equals("Delayed")) {
val target = this.currentTarget ?: discoveredTargets.getOrNull(0) ?: return
startBlocking(
target,
interactAutoBlockValue.get() && (mc.thePlayer.getDistanceToEntityBox(target) < maxRange)
)
if (attackTimer.hasTimePassed((attackDelay.toDouble() * 0.9).toLong()) && (autoBlockValue.equals(
"Range"
) && canBlock) && autoBlockPacketValue.equals("KeyBlock")
) {
mc.gameSettings.keyBindUseItem.pressed = false
}

if (autoBlockValue.equals("Range") && autoBlockPacketValue.equals("Test2") && !blockingStatus && test2_block) {
if (discoveredTargets.isNotEmpty()) {
val target = this.currentTarget ?: discoveredTargets.first()
startBlocking(
target,
interactAutoBlockValue.get() && (mc.thePlayer.getDistanceToEntityBox(target) < maxRange)
)
blockingStatus = true
test2_block = false
}
if (delayBlockTimer.hasTimePassed(30) && (autoBlockValue.equals("Range") && canBlock)) {
if (autoBlockPacketValue.equals("KeyBlock"))
mc.gameSettings.keyBindUseItem.pressed = true
}
}
}
if (autoBlockPacketValue.equals("Delayed")) {
val target = this.currentTarget ?: discoveredTargets.getOrNull(0) ?: return
startBlocking(
target,
interactAutoBlockValue.get() && (mc.thePlayer.getDistanceToEntityBox(target) < maxRange)
)
}

@EventTarget
fun onJump(event: JumpEvent) {
if (jumpFixValue.get()) {
if (autoBlockValue.equals("Range") && autoBlockPacketValue.equals("Test2") && !blockingStatus && test2_block) {
if (discoveredTargets.isNotEmpty()) {
event.yaw = RotationUtils.serverRotation!!.yaw
val target = this.currentTarget ?: discoveredTargets.first()
startBlocking(
target,
interactAutoBlockValue.get() && (mc.thePlayer.getDistanceToEntityBox(target) < maxRange)
)
blockingStatus = true
test2_block = false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import net.ccbluex.liquidbounce.features.value.IntegerValue
import net.ccbluex.liquidbounce.features.value.ListValue
import net.ccbluex.liquidbounce.utils.MathUtils.center
import net.ccbluex.liquidbounce.utils.MovementUtils
import net.ccbluex.liquidbounce.utils.PacketUtils
import net.ccbluex.liquidbounce.utils.Rotation
import net.ccbluex.liquidbounce.utils.RotationUtils
import net.ccbluex.liquidbounce.utils.RotationUtils.Companion.getAngleDifference
Expand Down Expand Up @@ -72,10 +73,12 @@ class SuperKnockback : Module() {
if (mc.thePlayer.isSprinting) {
mc.thePlayer.isSprinting = true
}
mc.netHandler.addToSendQueue(C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING))
mc.netHandler.addToSendQueue(C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING))
mc.netHandler.addToSendQueue(C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING))
mc.netHandler.addToSendQueue(C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING))
PacketUtils.sendPackets(
C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING),
C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING),
C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING),
C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)
)
mc.thePlayer.serverSprintState = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.client.gui.inventory.GuiContainer
import net.minecraft.client.gui.inventory.GuiInventory
import net.minecraft.client.settings.GameSettings
import net.minecraft.client.settings.KeyBinding
import net.minecraft.network.play.client.C03PacketPlayer
import net.minecraft.network.play.client.C0BPacketEntityAction
import net.minecraft.network.play.client.C0DPacketCloseWindow
Expand All @@ -26,6 +27,7 @@ import net.minecraft.network.play.client.C16PacketClientStatus
import net.minecraft.network.play.server.S2DPacketOpenWindow
import net.minecraft.network.play.server.S2EPacketCloseWindow
import org.lwjgl.input.Keyboard
import org.lwjgl.input.Mouse

@ModuleInfo(name = "InvMove", category = ModuleCategory.MOVEMENT)
object InvMove : Module() {
Expand All @@ -46,14 +48,27 @@ object InvMove : Module() {

private var isInv = false

private val affectedBindings = arrayOf(
mc.gameSettings.keyBindForward,
mc.gameSettings.keyBindBack,
mc.gameSettings.keyBindRight,
mc.gameSettings.keyBindLeft,
mc.gameSettings.keyBindJump,
mc.gameSettings.keyBindSprint
)

private fun isButtonPressed(keyBinding: KeyBinding): Boolean {
return if (keyBinding.keyCode < 0) {
Mouse.isButtonDown(keyBinding.keyCode + 100)
} else {
GameSettings.isKeyDown(keyBinding)
}
}

private fun updateKeyState() {
if (mc.currentScreen != null && mc.currentScreen !is GuiChat && (!noDetectableValue.get() || mc.currentScreen !is GuiContainer)) {
mc.gameSettings.keyBindForward.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindForward)
mc.gameSettings.keyBindBack.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindBack)
mc.gameSettings.keyBindRight.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindRight)
mc.gameSettings.keyBindLeft.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindLeft)
mc.gameSettings.keyBindJump.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindJump)
mc.gameSettings.keyBindSprint.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindSprint)
for (affectedBinding in affectedBindings)
affectedBinding.pressed = isButtonPressed(affectedBinding)

if (rotateValue.get()) {
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
Expand Down Expand Up @@ -144,9 +159,10 @@ object InvMove : Module() {
event.cancelEvent()

PacketUtils.sendPacket(C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT),false)
packetListYes.forEach {
PacketUtils.sendPacket(it,false)
}
PacketUtils.sendPacket(packetListYes.iterator().next())
// packetListYes.forEach {
// PacketUtils.sendPacket(it,false)
// }
packetListYes.clear()
PacketUtils.sendPacket(C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId),false)
}
Expand Down Expand Up @@ -198,27 +214,8 @@ object InvMove : Module() {
}

private fun reset() {
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindForward) || mc.currentScreen != null) {
mc.gameSettings.keyBindForward.pressed = false
}
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindBack) || mc.currentScreen != null) {
mc.gameSettings.keyBindBack.pressed = false
}
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindRight) || mc.currentScreen != null) {
mc.gameSettings.keyBindRight.pressed = false
}
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindLeft) || mc.currentScreen != null) {
mc.gameSettings.keyBindLeft.pressed = false
}
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindJump) || mc.currentScreen != null) {
mc.gameSettings.keyBindJump.pressed = false
}
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindSprint) || mc.currentScreen != null) {
mc.gameSettings.keyBindSprint.pressed = false
}
if (!GameSettings.isKeyDown(mc.gameSettings.keyBindSneak) || mc.currentScreen != null) {
mc.gameSettings.keyBindSneak.pressed = false
}
for (affectedBinding in affectedBindings)
affectedBinding.pressed = !isButtonPressed(affectedBinding)
}

override fun onDisable() {
Expand Down
Loading

0 comments on commit 6364f38

Please sign in to comment.