From bbcff96f91763984c14b3548373a47fe1e92b860 Mon Sep 17 00:00:00 2001 From: Tecnio <50290580+Tecnio@users.noreply.github.com> Date: Sat, 17 Feb 2024 21:40:00 +0300 Subject: [PATCH] incognito making me work on this --- pom.xml | 2 +- .../tecnio/ahm/check/impl/flight/FlightD.java | 3 +- .../data/tracker/impl/EmulationTracker.java | 199 +++++++++--------- src/main/resources/plugin.yml | 2 +- 4 files changed, 102 insertions(+), 104 deletions(-) diff --git a/pom.xml b/pom.xml index c5ddb9f..06a10c4 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ org.projectlombok lombok - 1.18.26 + 1.18.30 provided diff --git a/src/main/java/me/tecnio/ahm/check/impl/flight/FlightD.java b/src/main/java/me/tecnio/ahm/check/impl/flight/FlightD.java index 05f8352..189de4d 100644 --- a/src/main/java/me/tecnio/ahm/check/impl/flight/FlightD.java +++ b/src/main/java/me/tecnio/ahm/check/impl/flight/FlightD.java @@ -33,7 +33,8 @@ public void handle(final PositionUpdate update) { final boolean exempt = this.isExempt(ExemptType.VEHICLE, ExemptType.VELOCITY, ExemptType.PISTON, ExemptType.CLIMBABLE, ExemptType.TELEPORT, ExemptType.BOAT, ExemptType.TELEPORTED_RECENTLY, - ExemptType.UNDER_BLOCK, ExemptType.WEB, ExemptType.FLIGHT, ExemptType.SLIME, ExemptType.CHUNK, ExemptType.LIQUID); + ExemptType.UNDER_BLOCK, ExemptType.WEB, ExemptType.FLIGHT, ExemptType.SLIME, ExemptType.CHUNK, + ExemptType.LIQUID, ExemptType.JOIN); final boolean startedFalling = deltaY <= 0.2 && !ground; diff --git a/src/main/java/me/tecnio/ahm/data/tracker/impl/EmulationTracker.java b/src/main/java/me/tecnio/ahm/data/tracker/impl/EmulationTracker.java index 2aca2d3..f5b7e7b 100644 --- a/src/main/java/me/tecnio/ahm/data/tracker/impl/EmulationTracker.java +++ b/src/main/java/me/tecnio/ahm/data/tracker/impl/EmulationTracker.java @@ -33,112 +33,109 @@ public void handle(final GPacket packet) { // Set the lowest offset this.distance = Double.MAX_VALUE; - iteration: - { + iteration: { // Loop through the combos for (int f = -1; f < 2; f++) { for (int s = -1; s < 2; s++) { for (int sp = 0; sp < 2; sp++) { for (int jp = 0; jp < 2; jp++) { - for (int vl = 0; vl < 2; vl++) { - for (int ui = 0; ui < 2; ui++) { - for (int hs = 0; hs < 2; hs++) { - for (int fm = 0; fm < 2; fm++) { - final boolean sprint = sp == 0; - final boolean jump = jp == 0; - final boolean using = ui == 0; - final boolean hitSlowdown = hs == 0; - final boolean fastMath = fm == 1; - final boolean ground = data.getPositionTracker().isLastOnGround(); - final boolean sneaking = data.getActionTracker().isSneaking(); - final boolean velocity = vl == 0; - - if (f <= 0.0F && sprint && ground) continue; - - float forward = f; - float strafe = s; - - if (using) { - forward *= 0.2D; - strafe *= 0.2D; - } - - if (sneaking) { - forward *= (float) 0.3D; - strafe *= (float) 0.3D; - } - - forward *= 0.98F; - strafe *= 0.98F; - - final Motion motion = new Motion( - data.getPositionTracker().getLastDeltaX(), - 0.0D, - data.getPositionTracker().getLastDeltaZ()); - - if (data.getPositionTracker().isLastLastOnGround()) { - motion.getX().multiply(0.6F * 0.91F); - motion.getZ().multiply(0.6F * 0.91F); - } else { - motion.getX().multiply(0.91F); - motion.getZ().multiply(0.91F); - } - - if (velocity) { - data.getVelocityTracker().getActions().forEach(action -> action.accept(motion)); - } - - if (hitSlowdown) { - motion.getX().multiply(0.6D); - motion.getZ().multiply(0.6D); - - if (Math.abs(motion.getX().get()) < 0.005D) motion.getX().set(0.0D); - if (Math.abs(motion.getZ().get()) < 0.005D) motion.getZ().set(0.0D); - - if (jump && sprint) { - final float radians = data.getRotationTracker().getYaw() * 0.017453292F; - - motion.getX().subtract(sin(fastMath, radians) * 0.2F); - motion.getZ().add(cos(fastMath, radians) * 0.2F); - } - - float friction = 0.91F; - if (data.getPositionTracker().isLastOnGround()) friction *= 0.6F; - - final float moveSpeed = PlayerUtil.getAttributeSpeed(data, sprint); - final float moveFlyingFriction; - - if (ground) { - final float moveSpeedMultiplier = 0.16277136F / (friction * friction * friction); - - moveFlyingFriction = moveSpeed * moveSpeedMultiplier; - } else { - moveFlyingFriction = (float) (sprint - ? ((double) 0.02F + (double) 0.02F * 0.3D) - : 0.02F); - } - - final float[] moveFlying = this.moveFlying(forward, strafe, moveFlyingFriction, fastMath); - - motion.getX().add(moveFlying[0]); - motion.getZ().add(moveFlying[1]); - - final double distance = realMotion.distanceSquared(motion); - - // Set the lowest distance outcome - if (distance < this.distance) { - this.distance = distance; - this.motion = motion.clone(); - - this.sprint = sprint; - this.jump = jump; - this.using = using; - this.hitSlowdown = hitSlowdown; - this.fastMath = fastMath; - - if (distance < 1e-14) break iteration; - } - } + for (int ui = 0; ui < 2; ui++) { + for (int hs = 0; hs < 2; hs++) { + for (int fm = 0; fm < 2; fm++) { + final boolean sprint = sp == 0; + final boolean jump = jp == 0; + final boolean using = ui == 0; + final boolean hitSlowdown = hs == 0; + final boolean fastMath = fm == 1; + final boolean ground = data.getPositionTracker().isLastOnGround(); + final boolean sneaking = data.getActionTracker().isSneaking(); + + if (f <= 0.0F && sprint && ground) continue; + + float forward = f; + float strafe = s; + + if (using) { + forward *= 0.2D; + strafe *= 0.2D; + } + + if (sneaking) { + forward *= (float) 0.3D; + strafe *= (float) 0.3D; + } + + forward *= 0.98F; + strafe *= 0.98F; + + final Motion motion = new Motion( + data.getPositionTracker().getLastDeltaX(), + 0.0D, + data.getPositionTracker().getLastDeltaZ() + ); + + if (data.getPositionTracker().isLastLastOnGround()) { + motion.getX().multiply(0.6F * 0.91F); + motion.getZ().multiply(0.6F * 0.91F); + } else { + motion.getX().multiply(0.91F); + motion.getZ().multiply(0.91F); + } + + data.getVelocityTracker().getActions().forEach(action -> action.accept(motion)); + + if (hitSlowdown) { + motion.getX().multiply(0.6D); + motion.getZ().multiply(0.6D); + } + + if (Math.abs(motion.getX().get()) < 0.005D) motion.getX().set(0.0D); + if (Math.abs(motion.getZ().get()) < 0.005D) motion.getZ().set(0.0D); + + if (jump && sprint) { + final float radians = data.getRotationTracker().getYaw() * 0.017453292F; + + motion.getX().subtract(sin(fastMath, radians) * 0.2F); + motion.getZ().add(cos(fastMath, radians) * 0.2F); + } + + float friction = 0.91F; + if (data.getPositionTracker().isLastOnGround()) friction *= 0.6F; + + final float moveSpeed = PlayerUtil.getAttributeSpeed(data, sprint); + final float moveFlyingFriction; + + if (ground) { + final float moveSpeedMultiplier = 0.16277136F / (friction * friction * friction); + + moveFlyingFriction = moveSpeed * moveSpeedMultiplier; + } else { + moveFlyingFriction = (float) (sprint + ? ((double) 0.02F + (double) 0.02F * 0.3D) + : 0.02F); + } + + final float[] moveFlying = this.moveFlying(forward, strafe, moveFlyingFriction, fastMath); + + motion.getX().add(moveFlying[0]); + motion.getZ().add(moveFlying[1]); + + motion.getY().set(0.0D); + + final double distance = realMotion.distanceSquared(motion); + + // Set the lowest distance outcome + if (distance < this.distance) { + this.distance = distance; + this.motion = motion.clone(); + + this.sprint = sprint; + this.jump = jump; + this.using = using; + this.hitSlowdown = hitSlowdown; + this.fastMath = fastMath; + + if (distance < 1e-14) break iteration; } } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d8394f8..5ab22c3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: AntiHaxerman -version: 4.0-RC-6 +version: 4.0.0 main: me.tecnio.ahm.AHMPlugin authors: [Tecnio, Incognito, aSwitch] description: An open-sourced anti-cheat solution.