Skip to content

Commit

Permalink
So Many Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed May 26, 2024
1 parent de817df commit 146a270
Show file tree
Hide file tree
Showing 45 changed files with 433 additions and 1,480 deletions.
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ dependencies {
exclude module: "gson"
exclude module: "launchwrapper"
exclude module: "log4j-core"
exclude module: "slf4j-api"
}

include "org.slf4j:slf4j-api:${project.slf4j_version}"
include "org.yaml:snakeyaml:${project.snake_yml_version}"

include "com.squareup.okhttp3:okhttp:${project.okhttp_version}"

include('com.github.half-cambodian-hacker-man:Koffee:d8cee73') {
Expand Down
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ detekt_version = 1.23.6
forgegradle_version = a3d86a59c0
mixingradle_version = ae2a80e

okhttp_version=4.9.1
snake_yml_version=2.2
slf4j_version=2.0.12
okhttp_version=4.9.1
2 changes: 1 addition & 1 deletion src/main/java/net/aspw/client/Launch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object Launch {
// Client information
const val CLIENT_BEST = "NightX"
const val CLIENT_FOLDER = "NightX-Client"
const val CLIENT_VERSION = "B128"
const val CLIENT_VERSION = "B129"
const val CLIENT_CHAT = "§7[§5N§di§3g§bh§6t§aX§7] [§eInfo§7] §r"

var isStarting = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ class ModuleManager : Listenable {
ReverseFreecam::class.java,
HiderESP::class.java,
LegitVelocity::class.java,
PredictRender::class.java,
BlinkAntiVoid::class.java
PredictRender::class.java
)

ClientUtils.getLogger().info("Successfully loaded modules")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class AutoHeal : Module() {
private var rotated = false
private var potting = false
private var potIndex = -1
private var oldSlot = -1
var oldSlot = -1
var equipTime = false

private var throwTimer = MSTimer()
private var resetTimer = MSTimer()
Expand All @@ -64,7 +65,7 @@ class AutoHeal : Module() {
private val throwQueue = arrayListOf<Int>()

val killAura = Launch.moduleManager.getModule(KillAura::class.java)
val killAuraRecode = Launch.moduleManager.getModule(KillAuraRecode::class.java)
private val killAuraRecode = Launch.moduleManager.getModule(KillAuraRecode::class.java)
val scaffold = Launch.moduleManager.getModule(Scaffold::class.java)
private val legitScaffold = Launch.moduleManager.getModule(LegitScaffold::class.java)

Expand All @@ -75,6 +76,7 @@ class AutoHeal : Module() {

private fun resetAll() {
potting = false
equipTime = false
throwing = false
isRotating = false
rotated = false
Expand Down Expand Up @@ -167,6 +169,7 @@ class AutoHeal : Module() {

if (throwing && !mc.thePlayer.isEating && !mc.thePlayer.isInWater && MovementUtils.isRidingBlock() && mc.inGameHasFocus && Display.isActive() && mc.currentScreen !is GuiContainer && (!killAura?.state!! || killAura.target == null) && (!killAuraRecode?.state!! || !killAuraRecode.isTargeting) && !scaffold?.state!! && !legitScaffold?.state!!) {
if (mc.thePlayer.onGround) {
equipTime = true
potting = false
RotationUtils.setTargetRotation(
Rotation(
Expand Down Expand Up @@ -276,6 +279,7 @@ class AutoHeal : Module() {
mc.thePlayer.inventory.currentItem = oldSlot
mc.playerController.updateController()
potting = false
equipTime = false
throwing = false
tickTimer.reset()
debug("switch back")
Expand Down Expand Up @@ -303,6 +307,7 @@ class AutoHeal : Module() {
potIndex = -1
oldSlot = -1
throwing = false
equipTime = false
throwTimer.reset()
isRotating = false
tickTimer.reset()
Expand All @@ -312,6 +317,7 @@ class AutoHeal : Module() {
mc.thePlayer.inventory.currentItem = oldSlot
mc.playerController.updateController()
potting = false
equipTime = false
throwing = false
tickTimer.reset()
debug("failed to retrieve potion info, retrying...")
Expand Down
169 changes: 147 additions & 22 deletions src/main/java/net/aspw/client/features/module/impl/movement/AntiVoid.kt
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
package net.aspw.client.features.module.impl.movement

import net.aspw.client.Launch
import net.aspw.client.event.EventTarget
import net.aspw.client.event.MoveEvent
import net.aspw.client.event.PacketEvent
import net.aspw.client.event.UpdateEvent
import net.aspw.client.event.*
import net.aspw.client.features.module.Module
import net.aspw.client.features.module.ModuleCategory
import net.aspw.client.features.module.ModuleInfo
import net.aspw.client.features.module.impl.player.Scaffold
import net.aspw.client.utils.MovementUtils
import net.aspw.client.utils.PacketUtils
import net.aspw.client.utils.PredictUtils
import net.aspw.client.utils.block.BlockUtils.getBlock
import net.aspw.client.utils.misc.NewFallingPlayer
import net.aspw.client.utils.misc.RandomUtils
import net.aspw.client.utils.pathfinder.MainPathFinder
import net.aspw.client.utils.pathfinder.Vec3
import net.aspw.client.value.BoolValue
import net.aspw.client.utils.timer.TickTimer
import net.aspw.client.value.FloatValue
import net.aspw.client.value.IntegerValue
import net.aspw.client.value.ListValue
import net.minecraft.block.BlockAir
import net.minecraft.network.Packet
import net.minecraft.network.play.client.C03PacketPlayer
import net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition
import net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook
import net.minecraft.network.play.server.S08PacketPlayerPosLook
import net.minecraft.util.BlockPos
import java.util.*
import java.util.concurrent.LinkedBlockingQueue
import kotlin.math.abs

@ModuleInfo(name = "AntiVoid", spacedName = "Anti Void", category = ModuleCategory.MOVEMENT)
class AntiVoid : Module() {
private val voidDetectionAlgorithm = ListValue("Detect-Method", arrayOf("Collision", "Predict"), "Collision")
private val setBackModeValue = ListValue(
"SetBack-Mode",
arrayOf(
"Blink",
"Teleport",
"FlyFlag",
"IllegalPacket",
Expand All @@ -46,17 +45,21 @@ class AntiVoid : Module() {
),
"FlyFlag"
)
private val voidDetectionAlgorithm = ListValue("Detect-Method", arrayOf("Collision", "Predict"), "Collision") {
!setBackModeValue.get().equals("blink", true)
}
private val maxFallDistSimulateValue = IntegerValue("Predict-CheckFallDistance", 255, 0, 255, "m") {
voidDetectionAlgorithm.get().equals("predict", ignoreCase = true)
voidDetectionAlgorithm.get().equals("predict", ignoreCase = true) && !setBackModeValue.get()
.equals("blink", true)
}
private val maxFindRangeValue = IntegerValue("Predict-MaxFindRange", 60, 0, 255, "m") {
voidDetectionAlgorithm.get().equals("predict", ignoreCase = true)
voidDetectionAlgorithm.get().equals("predict", ignoreCase = true) && !setBackModeValue.get()
.equals("blink", true)
}
private val illegalDupeValue = IntegerValue("Illegal-Dupe", 1, 1, 5, "x") {
setBackModeValue.get().lowercase(Locale.getDefault()).contains("illegal")
}
private val setBackFallDistValue = FloatValue("Max-FallDistance", 5f, 0f, 255f, "m")
private val scaffoldValue = BoolValue("AutoScaffold", false)
private val setBackFallDistValue = FloatValue("Max-FallDistance", 8f, 0f, 255f, "m")
private val positions = LinkedList<DoubleArray>()
private var detectedLocation = BlockPos.ORIGIN
private var lastX = 0.0
Expand All @@ -66,10 +69,21 @@ class AntiVoid : Module() {
private var shouldRender = false
private var shouldStopMotion = false
private var shouldEdit = false
private var packets = LinkedBlockingQueue<Packet<*>>()
private var safeTimer = TickTimer()
private var togglePrevent = false
private var disableLogger = false
private var preX: Double? = null
private var preY: Double? = null
private var preZ: Double? = null
private var preYaw: Float? = null
private var prePitch: Float? = null

@EventTarget
fun onUpdate(event: UpdateEvent?) {
if (Launch.moduleManager.getModule(Flight::class.java)!!.state) return
if (Launch.moduleManager.getModule(Flight::class.java)!!.state || setBackModeValue.get()
.equals("blink", true)
) return
detectedLocation = null
if (voidDetectionAlgorithm.get().equals("collision", ignoreCase = true)) {
if (mc.thePlayer.onGround && getBlock(
Expand Down Expand Up @@ -165,9 +179,6 @@ class AntiVoid : Module() {
if (!setBackModeValue.get()
.equals("StopMotion", ignoreCase = true)
) mc.thePlayer.fallDistance = 0f
if (scaffoldValue.get() && !Launch.moduleManager.getModule(Scaffold::class.java)!!.state) Launch.moduleManager.getModule(
Scaffold::class.java
)!!.state = true
}
}
} else {
Expand Down Expand Up @@ -275,9 +286,6 @@ class AntiVoid : Module() {
if (!setBackModeValue.get()
.equals("StopMotion", ignoreCase = true)
) mc.thePlayer.fallDistance = 0f
if (scaffoldValue.get() && !Launch.moduleManager.getModule(Scaffold::class.java)!!.state) Launch.moduleManager.getModule(
Scaffold::class.java
)!!.state = true
}
}
}
Expand All @@ -295,6 +303,26 @@ class AntiVoid : Module() {
@EventTarget
fun onPacket(event: PacketEvent) {
if (Launch.moduleManager.getModule(Flight::class.java)!!.state) return
val packet = event.packet
if (setBackModeValue.get().equals("blink", true)) {
if (mc.thePlayer == null || disableLogger || !togglePrevent) return
if (packet is C03PacketPlayer) {
if (preX == null)
preX = packet.x
if (preY == null)
preY = packet.y
if (preZ == null)
preZ = packet.z
if (preYaw == null)
preYaw = packet.yaw
if (prePitch == null)
prePitch = packet.pitch
packets.add(packet)
safeTimer.update()
event.cancelEvent()
}
return
}
if (setBackModeValue.get()
.equals("StopMotion", ignoreCase = true) && event.packet is S08PacketPlayerPosLook
) mc.thePlayer.fallDistance = 0f
Expand All @@ -316,18 +344,115 @@ class AntiVoid : Module() {

@EventTarget
fun onMove(event: MoveEvent) {
if (Launch.moduleManager.getModule(Flight::class.java)!!.state) return
if (setBackModeValue.get().equals("StopMotion", ignoreCase = true) && shouldStopMotion) {
if (Launch.moduleManager.getModule(Flight::class.java)!!.state || setBackModeValue.get()
.equals("blink", true)
) return
if (setBackModeValue.get().equals("StopMotion", ignoreCase = true) && shouldStopMotion)
event.zero()
}

@EventTarget
fun onRender3D(event: Render3DEvent) {
if (setBackModeValue.get().equals("blink", true)) {
togglePrevent = PredictUtils.checkVoid(7)
if (togglePrevent) {
if (abs(mc.thePlayer.posY - preY!!) > setBackFallDistValue.get()) {
mc.thePlayer.setPositionAndRotation(preX!!, preY!!, preZ!!, preYaw!!, prePitch!!)
mc.thePlayer.motionX = 0.0
mc.thePlayer.motionY = 0.0
mc.thePlayer.motionZ = 0.0
resetBlink()
} else if (safeTimer.hasTimePassed(20) || shouldSync(0.8f) || shouldSync(1.8f))
sync()
} else sync()
}
}

@EventTarget
fun onWorld(event: WorldEvent) {
if (setBackModeValue.get().equals("blink", true))
resetBlink()
}

@EventTarget
fun onTeleport(event: TeleportEvent) {
if (setBackModeValue.get().equals("blink", true)) {
if (togglePrevent) {
if (preX == null)
preX = event.posX
if (preY == null)
preY = event.posY
if (preZ == null)
preZ = event.posZ
if (preYaw == null)
preYaw = event.yaw
if (prePitch == null)
prePitch = event.pitch
}
}
}

override fun onDisable() {
reset()
resetBlink()
}

override fun onEnable() {
reset()
private fun shouldSync(y: Float): Boolean {
return mc.theWorld.getBlockState(
BlockPos(
mc.thePlayer.posX,
mc.thePlayer.posY - y,
mc.thePlayer.posZ
)
).block !is BlockAir || mc.theWorld.getBlockState(
BlockPos(
mc.thePlayer.posX + 0.3,
mc.thePlayer.posY - y,
mc.thePlayer.posZ + 0.3
)
).block !is BlockAir || mc.theWorld.getBlockState(
BlockPos(
mc.thePlayer.posX + 0.3,
mc.thePlayer.posY - y,
mc.thePlayer.posZ - 0.3
)
).block !is BlockAir || mc.theWorld.getBlockState(
BlockPos(
mc.thePlayer.posX - 0.3,
mc.thePlayer.posY - y,
mc.thePlayer.posZ + 0.3
)
).block !is BlockAir || mc.theWorld.getBlockState(
BlockPos(
mc.thePlayer.posX - 0.3,
mc.thePlayer.posY - y,
mc.thePlayer.posZ - 0.3
)
).block !is BlockAir
}

private fun sync() {
try {
disableLogger = true
while (packets.isNotEmpty()) {
mc.netHandler.networkManager.sendPacket(packets.take())
}
resetBlink()
} catch (_: Exception) {
}
}

private fun resetBlink() {
if (packets.isNotEmpty())
packets.clear()
safeTimer.reset()
togglePrevent = false
disableLogger = false
preX = null
preY = null
preZ = null
preYaw = null
prePitch = null
}

private fun reset() {
Expand Down
Loading

0 comments on commit 146a270

Please sign in to comment.