Skip to content

Commit

Permalink
AntiVoid Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetchnoblade committed May 25, 2024
1 parent 1a6fc05 commit 7d5b073
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 17 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ dependencies {
exclude module: "kotlin-stdlib"
exclude module: "authlib"
}

include 'com.github.ben-manes.caffeine:caffeine:2.9.0'
}

shadowJar {
Expand Down
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 = "B127"
const val CLIENT_VERSION = "B128-Beta"
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 @@ -9,6 +9,7 @@
import net.aspw.client.features.module.impl.visual.Animations;
import net.aspw.client.features.module.impl.visual.SilentRotations;
import net.aspw.client.utils.MinecraftInstance;
import net.aspw.client.utils.PredictUtils;
import net.aspw.client.utils.RotationUtils;
import net.aspw.client.utils.pathfinder.MainPathFinder;
import net.aspw.client.utils.pathfinder.Vec3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class ModuleManager : Listenable {
ReverseFreecam::class.java,
HiderESP::class.java,
LegitVelocity::class.java,
Debug::class.java
PredictRender::class.java,
Test::class.java
)

ClientUtils.getLogger().info("Successfully loaded modules")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.aspw.client.features.module.impl.exploit
package net.aspw.client.features.module.impl.visual

import net.aspw.client.event.EventTarget
import net.aspw.client.event.Render3DEvent
Expand All @@ -9,9 +9,9 @@ import net.aspw.client.utils.PredictUtils
import net.aspw.client.utils.render.RenderUtils
import net.aspw.client.value.IntegerValue

@ModuleInfo(name = "Debug", category = ModuleCategory.EXPLOIT)
class Debug : Module() {
private val rangeValue = IntegerValue("Range", 100, 0, 200)
@ModuleInfo(name = "PredictRender", spacedName = "Predict Render", category = ModuleCategory.VISUAL)
class PredictRender : Module() {
private val rangeValue = IntegerValue("Range", 20, 0, 100)

@EventTarget
fun onRender3D(event: Render3DEvent) {
Expand Down
87 changes: 87 additions & 0 deletions src/main/java/net/aspw/client/features/module/impl/visual/Test.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package net.aspw.client.features.module.impl.visual

import net.aspw.client.event.EventTarget
import net.aspw.client.event.PacketEvent
import net.aspw.client.event.Render3DEvent
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.utils.PredictUtils
import net.aspw.client.utils.timer.TickTimer
import net.minecraft.network.Packet
import net.minecraft.network.play.client.C03PacketPlayer
import java.util.concurrent.LinkedBlockingQueue
import kotlin.math.abs

@ModuleInfo(name = "Test", spacedName = "Test", category = ModuleCategory.VISUAL)
class Test : Module() {

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

override fun onDisable() {
reset()
}

@EventTarget
fun onRender3D(event: Render3DEvent) {
togglePrevent = PredictUtils.checkVoid()
if (togglePrevent) {
if (abs(mc.thePlayer.posY - preY!!) > 8) {
mc.thePlayer.motionX = 0.0
mc.thePlayer.motionZ = 0.0
mc.thePlayer.setPositionAndUpdate(preX!!, preY!!, preZ!!)
chat("set back")
reset()
} else if (safeTimer.hasTimePassed(60)) {
sync()
chat("realsync")
}
} else sync()
}

@EventTarget
fun onPacket(event: PacketEvent) {
val packet = event.packet
if (mc.thePlayer == null || disableLogger) return
if (packet is C03PacketPlayer && togglePrevent) {
chat("CANCEL")
if (preX == null)
preX = mc.thePlayer.posX
if (preY == null)
preY = mc.thePlayer.posY
if (preZ == null)
preZ = mc.thePlayer.posZ
packets.add(packet)
safeTimer.update()
event.cancelEvent()
}
}

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

private fun reset() {
if (packets.isNotEmpty())
packets.clear()
safeTimer.reset()
togglePrevent = false
disableLogger = false
preX = null
preY = null
preZ = null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public boolean alwaysReturnTrue(World world, BlockPos pos) {
}

@Inject(method = "spawnRunningParticles", at = @At("HEAD"), cancellable = true)
private void checkGroundState(CallbackInfo ci) {
private void spawnRunningParticles(CallbackInfo ci) {
if (!this.onGround || PredictUtils.predicting) ci.cancel();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import net.aspw.client.Launch;
import net.aspw.client.event.EntityMovementEvent;
import net.aspw.client.event.TeleportEvent;
import net.aspw.client.utils.PredictUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketThreadUtil;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.network.play.client.C03PacketPlayer;
Expand All @@ -20,6 +22,7 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(NetHandlerPlayClient.class)
Expand All @@ -43,6 +46,11 @@ private void handleEntityMovementEvent(S14PacketEntity packetIn, final CallbackI
Launch.eventManager.callEvent(new EntityMovementEvent(entity));
}

@Inject(method = "addToSendQueue", at = @At("HEAD"), cancellable = true)
private void addToSendQueue(Packet<?> packet, CallbackInfo callbackInfo) {
if (PredictUtils.predicting) callbackInfo.cancel();
}

/**
* @author As_pw
* @reason Teleport Event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ protected void channelRead0(final ChannelHandlerContext p_channelRead0_1_, final

@Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
private void send(final Packet<?> packet, final CallbackInfo callback) {
if (PredictUtils.predicting) callback.cancel();
if (PacketUtils.handleSendPacket(packet)) return;
final PacketEvent event = new PacketEvent(packet);
final BackTrack backTrack = Launch.moduleManager.getModule(BackTrack.class);
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/net/aspw/client/utils/APIConnecter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ object APIConnecter {
sslContext.init(null, trustAllCerts, java.security.SecureRandom())
}

fun callImage(image: String, location: String): ResourceLocation? {
fun callImage(image: String, location: String): ResourceLocation {
for ((i, l, s) in pictures) {
if (i == image && l == location)
return s
}
return null
return ResourceLocation("client/temp.png")
}

fun callMainMenu(image: Int): ResourceLocation? {
fun callMainMenu(image: Int): ResourceLocation {
for ((i, l) in mainmenu) {
if (i == image)
return l
}
return null
return ResourceLocation("client/temp.png")
}

fun loadPictures() {
Expand Down Expand Up @@ -124,8 +124,7 @@ object APIConnecter {
ClientUtils.getLogger().info("Load MainMenu $counter")
maxTicks = counter
}
} catch (e: Exception) {
ClientUtils.getLogger().info("Loaded MainMenu")
} catch (_: Exception) {
}
}

Expand Down
57 changes: 57 additions & 0 deletions src/main/java/net/aspw/client/utils/PredictUtils.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
package net.aspw.client.utils;

import net.aspw.client.utils.block.BlockUtils;
import net.minecraft.block.BlockAir;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.stats.StatFileWriter;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovementInputFromOptions;
import net.minecraft.util.Vec3;
import org.lwjgl.opengl.GL11;

import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class PredictUtils extends MinecraftInstance {

Expand Down Expand Up @@ -42,4 +54,49 @@ public static LinkedList<Vec3> predict(int tick) {
predicting = false;
return positions;
}

public static boolean checkVoid() {
predicting = true;
EntityPlayerSP sp = new EntityPlayerSP(
mc,
mc.theWorld,
mc.getNetHandler(),
new StatFileWriter()
);
sp.setPositionAndRotation(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);
sp.onGround = mc.thePlayer.onGround;
sp.setSneaking(mc.thePlayer.isSneaking());
sp.motionX = mc.thePlayer.motionX;
sp.motionY = mc.thePlayer.motionY;
sp.motionZ = mc.thePlayer.motionZ;
sp.movementInput = new MovementInputFromOptions(mc.gameSettings);
for (int i = 0; i < 8; i++) {
sp.movementInput.moveStrafe = mc.thePlayer.movementInput.moveStrafe;
sp.movementInput.moveForward = mc.thePlayer.movementInput.moveForward;
sp.movementInput.sneak = mc.thePlayer.movementInput.sneak;
sp.moveForward = mc.thePlayer.moveForward;
sp.moveStrafing = mc.thePlayer.moveStrafing;
sp.setJumping(mc.thePlayer.movementInput.jump);
sp.onUpdate();
boolean isNotSafe = detectVoid(sp);
if (isNotSafe) {
predicting = false;
return true;
}
}
predicting = false;
return false;
}

private static boolean detectVoid(EntityPlayerSP sp) {
boolean doing = true;
for (double yOffset = -1; yOffset >= -100; yOffset--) {
BlockPos blockPos = new BlockPos(sp.posX, sp.posY + yOffset, sp.posZ);
if (!(BlockUtils.getBlock(blockPos) instanceof BlockAir)) {
doing = false;
break;
}
}
return doing && sp.fallDistance != 0 && mc.thePlayer != null && mc.theWorld != null;
}
}
2 changes: 1 addition & 1 deletion src/main/java/net/aspw/client/utils/SettingsUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ object SettingsUtils {
MacroManager.macroMapping.filter { it.key != 0 }
.forEach { stringBuilder.append("macro ${it.key} ${it.value}").append("\n") }

Launch.moduleManager.modules.filter { it !is SnakeGame && it !is TargetESP && it !is Gui && it !is Cape && it !is Trajectories && it !is XRay && it !is MotionBlur && it !is DiscordRPC && it !is CustomModel && it !is EnchantColor && it !is ItemPhysics && it !is StreamerMode && it !is Tracers && it !is Freecam && it !is Plugins && it !is Interface && it !is Animations }
Launch.moduleManager.modules.filter { it !is SnakeGame && it !is TargetESP && it !is Gui && it !is Cape && it !is PredictRender && it !is Trajectories && it !is XRay && it !is MotionBlur && it !is DiscordRPC && it !is CustomModel && it !is EnchantColor && it !is ItemPhysics && it !is StreamerMode && it !is Tracers && it !is Freecam && it !is Plugins && it !is Interface && it !is Animations }
.forEach {
if (values)
it.values.forEach { value ->
Expand Down
Binary file added src/main/resources/assets/minecraft/client/temp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7d5b073

Please sign in to comment.