Skip to content

Commit

Permalink
BlinkAntiVoid
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed May 25, 2024
1 parent 7d5b073 commit 3e38f98
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
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 @@ -158,7 +158,7 @@ class ModuleManager : Listenable {
HiderESP::class.java,
LegitVelocity::class.java,
PredictRender::class.java,
Test::class.java
BlinkAntiVoid::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.visual
package net.aspw.client.features.module.impl.movement

import net.aspw.client.event.EventTarget
import net.aspw.client.event.PacketEvent
Expand All @@ -13,8 +13,8 @@ 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() {
@ModuleInfo(name = "BlinkAntiVoid", spacedName = "Blink Anti Void", category = ModuleCategory.MOVEMENT)
class BlinkAntiVoid : Module() {

private var packets = LinkedBlockingQueue<Packet<*>>()
private var safeTimer = TickTimer()
Expand All @@ -23,24 +23,25 @@ class Test : Module() {
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

override fun onDisable() {
reset()
}

@EventTarget
fun onRender3D(event: Render3DEvent) {
togglePrevent = PredictUtils.checkVoid()
togglePrevent = PredictUtils.checkVoid(5)
if (togglePrevent) {
if (abs(mc.thePlayer.posY - preY!!) > 8) {
mc.thePlayer.setPositionAndRotation(preX!!, preY!!, preZ!!, preYaw!!, prePitch!!)
mc.thePlayer.motionX = 0.0
mc.thePlayer.motionY = 0.0
mc.thePlayer.motionZ = 0.0
mc.thePlayer.setPositionAndUpdate(preX!!, preY!!, preZ!!)
chat("set back")
reset()
} else if (safeTimer.hasTimePassed(60)) {
} else if (safeTimer.hasTimePassed(60) || mc.thePlayer.onGround) {
sync()
chat("realsync")
}
} else sync()
}
Expand All @@ -50,13 +51,16 @@ class Test : Module() {
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
if (preYaw == null)
preYaw = mc.thePlayer.rotationYaw
if (prePitch == null)
prePitch = mc.thePlayer.rotationPitch
packets.add(packet)
safeTimer.update()
event.cancelEvent()
Expand All @@ -83,5 +87,7 @@ class Test : Module() {
preX = null
preY = null
preZ = null
preYaw = null
prePitch = null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
import net.aspw.client.features.module.impl.movement.SilentSneak;
import net.aspw.client.features.module.impl.player.Scaffold;
import net.aspw.client.features.module.impl.visual.Interface;
import net.aspw.client.utils.CooldownHelper;
import net.aspw.client.utils.MovementUtils;
import net.aspw.client.utils.Rotation;
import net.aspw.client.utils.RotationUtils;
import net.aspw.client.utils.*;
import net.aspw.client.visual.client.clickgui.dropdown.ClickGui;
import net.aspw.client.visual.client.clickgui.smooth.SmoothClickGui;
import net.aspw.client.visual.client.clickgui.tab.NewUi;
Expand All @@ -27,10 +24,12 @@
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemSword;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.client.C0CPacketInput;
import net.minecraft.potion.Potion;
import net.minecraft.util.*;
import org.spongepowered.asm.mixin.*;
Expand Down Expand Up @@ -157,7 +156,7 @@ public void updateEntityActionState() {
@Overwrite
public void onUpdateWalkingPlayer() {
final MotionEvent event = new MotionEvent(this.posX, this.getEntityBoundingBox().minY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround);
Launch.eventManager.callEvent(event);
if (!PredictUtils.predicting) Launch.eventManager.callEvent(event);

final SilentSneak sneak = Objects.requireNonNull(Launch.moduleManager.getModule(SilentSneak.class));
final boolean fakeSprint = sneak.getState() && (!MovementUtils.isMoving());
Expand All @@ -168,18 +167,18 @@ public void onUpdateWalkingPlayer() {
final boolean sneaking = actionEvent.getSneaking();

if (sprinting != this.serverSprintState) {
if (sprinting)
if (sprinting && !PredictUtils.predicting)
this.sendQueue.addToSendQueue(new C0BPacketEntityAction((EntityPlayerSP) (Object) this, C0BPacketEntityAction.Action.START_SPRINTING));
else
else if (!PredictUtils.predicting)
this.sendQueue.addToSendQueue(new C0BPacketEntityAction((EntityPlayerSP) (Object) this, C0BPacketEntityAction.Action.STOP_SPRINTING));

this.serverSprintState = sprinting;
}

if (sneaking != this.serverSneakState && (!sneak.getState() || sneak.modeValue.get().equalsIgnoreCase("Legit"))) {
if (sneaking)
if (sneaking && !PredictUtils.predicting)
this.sendQueue.addToSendQueue(new C0BPacketEntityAction((EntityPlayerSP) (Object) this, C0BPacketEntityAction.Action.START_SNEAKING));
else
else if (!PredictUtils.predicting)
this.sendQueue.addToSendQueue(new C0BPacketEntityAction((EntityPlayerSP) (Object) this, C0BPacketEntityAction.Action.STOP_SNEAKING));

this.serverSneakState = sneaking;
Expand All @@ -205,16 +204,16 @@ public void onUpdateWalkingPlayer() {

if (this.ridingEntity == null) {
if (moved && rotated) {
sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(posX, getEntityBoundingBox().minY, posZ, yaw, pitch, onGround));
if (!PredictUtils.predicting) sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(posX, getEntityBoundingBox().minY, posZ, yaw, pitch, onGround));
} else if (moved) {
sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, getEntityBoundingBox().minY, posZ, onGround));
if (!PredictUtils.predicting) sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(posX, getEntityBoundingBox().minY, posZ, onGround));
} else if (rotated) {
sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(yaw, pitch, onGround));
if (!PredictUtils.predicting) sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(yaw, pitch, onGround));
} else {
sendQueue.addToSendQueue(new C03PacketPlayer(onGround));
if (!PredictUtils.predicting) sendQueue.addToSendQueue(new C03PacketPlayer(onGround));
}
} else {
sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(motionX, -999, motionZ, yaw, pitch, onGround));
if (!PredictUtils.predicting) sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(motionX, -999, motionZ, yaw, pitch, onGround));
moved = false;
}

Expand All @@ -236,9 +235,9 @@ public void onUpdateWalkingPlayer() {
if (this.isCurrentViewEntity())
lastOnGround = event.getOnGround();

event.setEventState(EventState.POST);
if (!PredictUtils.predicting) event.setEventState(EventState.POST);

Launch.eventManager.callEvent(event);
if (!PredictUtils.predicting) Launch.eventManager.callEvent(event);
}

@Inject(method = "swingItem", at = @At("HEAD"))
Expand Down Expand Up @@ -266,7 +265,6 @@ private void onPushOutOfBlocks(final CallbackInfoReturnable<Boolean> callbackInf
@Override
@Overwrite
public void onLivingUpdate() {
Launch.eventManager.callEvent(new UpdateEvent());
if (mc.currentScreen instanceof NewUi || mc.currentScreen instanceof ClickGui || mc.currentScreen instanceof SmoothClickGui) {
mc.gameSettings.keyBindForward.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindForward);
mc.gameSettings.keyBindBack.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindBack);
Expand All @@ -276,11 +274,13 @@ public void onLivingUpdate() {
mc.gameSettings.keyBindSprint.pressed = GameSettings.isKeyDown(mc.gameSettings.keyBindSprint);
}

if (!PredictUtils.predicting) Launch.eventManager.callEvent(new UpdateEvent());

if (this.sprintingTicksLeft > 0) {
--this.sprintingTicksLeft;

if (this.sprintingTicksLeft == 0) {
this.setSprinting(false);
if (!PredictUtils.predicting) this.setSprinting(false);
}
}

Expand Down Expand Up @@ -339,7 +339,7 @@ public void onLivingUpdate() {

if (getHeldItem() != null && (this.isUsingItem() || (getHeldItem().getItem() instanceof ItemSword && mc.thePlayer.isBlocking() && !this.isRiding()))) {
final SlowDownEvent slowDownEvent = new SlowDownEvent(0.2F, 0.2F);
Launch.eventManager.callEvent(slowDownEvent);
if (!PredictUtils.predicting) Launch.eventManager.callEvent(slowDownEvent);
this.movementInput.moveStrafe *= slowDownEvent.getStrafe();
this.movementInput.moveForward *= slowDownEvent.getForward();
this.sprintToggleTimer = 0;
Expand All @@ -356,19 +356,19 @@ public void onLivingUpdate() {
if (this.sprintToggleTimer <= 0 && !this.mc.gameSettings.keyBindSprint.isKeyDown()) {
this.sprintToggleTimer = 7;
} else {
this.setSprinting(true);
if (!PredictUtils.predicting) this.setSprinting(true);
}
}

if (!this.isSprinting() && this.movementInput.moveForward >= f && flag3 && (noSlow.getState() || !this.isUsingItem()) && !this.isPotionActive(Potion.blindness) && this.mc.gameSettings.keyBindSprint.isKeyDown())
if (!PredictUtils.predicting && !this.isSprinting() && this.movementInput.moveForward >= f && flag3 && (noSlow.getState() || !this.isUsingItem()) && !this.isPotionActive(Potion.blindness) && this.mc.gameSettings.keyBindSprint.isKeyDown())
this.setSprinting(true);

final Scaffold scaffold = Objects.requireNonNull(Launch.moduleManager.getModule(Scaffold.class));

if ((scaffold.getState() && scaffold.getCanTower() && scaffold.sprintModeValue.get().equalsIgnoreCase("Off")) || (scaffold.getState() && scaffold.sprintModeValue.get().equalsIgnoreCase("Off")) || RotationUtils.targetRotation != null && RotationUtils.getRotationDifference(new Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch)) > 30)
if (!PredictUtils.predicting && ((scaffold.getState() && scaffold.getCanTower() && scaffold.sprintModeValue.get().equalsIgnoreCase("Off")) || (scaffold.getState() && scaffold.sprintModeValue.get().equalsIgnoreCase("Off")) || RotationUtils.targetRotation != null && RotationUtils.getRotationDifference(new Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch)) > 30))
this.setSprinting(false);

if (this.isSprinting() && (this.movementInput.moveForward < f || mc.thePlayer.isCollidedHorizontally || !flag3))
if (!PredictUtils.predicting && (this.isSprinting() && (this.movementInput.moveForward < f || mc.thePlayer.isCollidedHorizontally || !flag3)))
this.setSprinting(false);

if (this.capabilities.allowFlying) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
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 @@ -46,11 +45,6 @@ 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
5 changes: 3 additions & 2 deletions src/main/java/net/aspw/client/utils/PredictUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.aspw.client.utils;

import net.aspw.client.utils.MinecraftInstance;
import net.aspw.client.utils.block.BlockUtils;
import net.minecraft.block.BlockAir;
import net.minecraft.client.entity.EntityOtherPlayerMP;
Expand Down Expand Up @@ -55,7 +56,7 @@ public static LinkedList<Vec3> predict(int tick) {
return positions;
}

public static boolean checkVoid() {
public static boolean checkVoid(int tick) {
predicting = true;
EntityPlayerSP sp = new EntityPlayerSP(
mc,
Expand All @@ -70,7 +71,7 @@ public static boolean checkVoid() {
sp.motionY = mc.thePlayer.motionY;
sp.motionZ = mc.thePlayer.motionZ;
sp.movementInput = new MovementInputFromOptions(mc.gameSettings);
for (int i = 0; i < 8; i++) {
for (int i = 0; i < tick; i++) {
sp.movementInput.moveStrafe = mc.thePlayer.movementInput.moveStrafe;
sp.movementInput.moveForward = mc.thePlayer.movementInput.moveForward;
sp.movementInput.sneak = mc.thePlayer.movementInput.sneak;
Expand Down

0 comments on commit 3e38f98

Please sign in to comment.