new Fly C check, fixing bugs

- Fixing NoFall (B) not flagging (error on formatting)
- Added new Fly (C) check
- Fixed buffer bypass on Horizontal check
- Working on fixing Hitbox origin false positive
This commit is contained in:
Dawson
2022-08-23 19:42:15 -04:00
parent 74dbed884a
commit 80239bd113
5 changed files with 40 additions and 11 deletions
@@ -65,8 +65,6 @@ public class Hitbox extends Check {
final KLocation to = target.two;
debug("current loc: %.4f, %.4f, %.4f", eloc.one.x, eloc.one.y, eloc.one.z);
if(eloc.one.x == 0 && eloc.one.y == 0 & eloc.one.z == 0) {
return;
}
@@ -81,7 +79,7 @@ public class Hitbox extends Check {
EntityData.getEntityBox(oldLocation.toVector(), target.one);
if(player.getPlayerVersion().isBelow(ProtocolVersion.V1_9)) {
box = box.expand(0.12);
box = box.expand(0.105);
} else box = box.expand(0.0325);
boxes.add(box);
}
@@ -90,7 +88,7 @@ public class Hitbox extends Check {
EntityData.getEntityBox(oldLocation.toVector(), target.one);
if(player.getPlayerVersion().isBelow(ProtocolVersion.V1_9)) {
box = box.expand(0.12);
box = box.expand(0.105);
} else box = box.expand(0.0325);
boxes.add(box);
}
@@ -100,7 +98,7 @@ public class Hitbox extends Check {
EntityData.getEntityBox(oldLocation.toVector(), target.one);
if(player.getPlayerVersion().isBelow(ProtocolVersion.V1_9)) {
box = box.expand(0.12);
box = box.expand(0.105);
} else box = box.expand(0.0325);
boxes.add(box);
}
@@ -110,7 +108,7 @@ public class Hitbox extends Check {
int hits = 0;
boolean didSneakOrElytra = player.getInfo().getLastElytra().isNotPassed(40)
boolean didSneakOrElytra = player.getInfo().getLastSneak().isNotPassed(40)
|| player.getInfo().getLastElytra().isNotPassed(40);
List<Vector> directions = new ArrayList<>(Arrays.asList(MathUtils.getDirection(
@@ -0,0 +1,16 @@
package dev.brighten.ac.check.impl.movement.fly;
import dev.brighten.ac.check.Check;
import dev.brighten.ac.check.WAction;
import dev.brighten.ac.data.APlayer;
import dev.brighten.ac.packet.wrapper.out.WPacketPlayOutEntityVelocity;
public class FlyC extends Check {
public FlyC(APlayer player) {
super(player);
}
WAction<WPacketPlayOutEntityVelocity> action = packet -> {
if(packet.getEntityId() != player.getBukkitPlayer().getEntityId()) return;
};
}
@@ -26,7 +26,7 @@ public class NoFallB extends Check {
|| player.getBlockInfo().miscNear
|| player.getInfo().inVehicle
|| player.getInfo().climbTimer.isNotPassed(3)
|| player.getCreation().isPassed(2000L)
|| player.getCreation().isNotPassed(2000L)
|| player.getInfo().slimeTimer.isNotPassed(3)) {
if(groundBuffer > 0) groundBuffer--;
if(airBuffer > 0) airBuffer--;
@@ -41,7 +41,7 @@ public class NoFallB extends Check {
&& !player.getInfo().isServerGround()) {
groundBuffer+= 2;
if(groundBuffer > 14) {
flag("[%.1f] g=%s;dy=%.4f;ldy=%.4f", groundBuffer, true,
flag("[%s] g=%s;dy=%.4f;ldy=%.4f", groundBuffer, true,
player.getMovement().getDeltaY(), player.getMovement().getLDeltaY());
}
} else if(groundBuffer > 0) groundBuffer--;
@@ -53,7 +53,7 @@ public class NoFallB extends Check {
&& ((player.getInfo().isServerGround() || player.getBlockInfo().blocksBelow)
&& dground && !player.getBlockInfo().onHalfBlock)) {
if((airBuffer +=10) > 30) {
flag("[%.1f] g=%s;dy=%.4f;ldy=%.4f", airBuffer, false,
flag("[%s] g=%s;dy=%.4f;ldy=%.4f", airBuffer, false,
player.getMovement().getDeltaY(), player.getMovement().getLDeltaY());
}
} else if(airBuffer > 0) airBuffer-= 4;
@@ -249,13 +249,13 @@ public class Horizontal extends Check {
if (player.getMovement().getDeltaXZ() > pmotion
&& smallestDelta > (player.getBlockInfo().onSoulSand ? 0.01 : 5E-13)
&& player.getMovement().getDeltaXZ() > 0.1) {
if ((buffer += smallestDelta > 58E-4 ? 1 : 0.5) > 3) {
if ((buffer += smallestDelta > 58E-5 ? 1 : 0.5) > 1) {
buffer = Math.min(3.5f, buffer); //Ensuring we don't have a run-away buffer
flag("smallest=%s b=%.1f to=%s dxz=%.2f", smallestDelta, buffer,
player.getMovement().getTo().getLoc(), player.getMovement().getDeltaXZ());
cancel();
} else debug("bad movement");
} else if (buffer > 0) buffer -= 0.1f;
} else if (buffer > 0) buffer -= 0.05f;
debug("smallest=%s pm=%.5f dxz=%.5f b=%.1f f/s=%.2f,%.2f soulsand=%s", smallestDelta, pmotion,
player.getMovement().getDeltaXZ(), buffer, forward, strafe,
@@ -0,0 +1,15 @@
package dev.brighten.ac.handler;
import dev.brighten.ac.data.APlayer;
import dev.brighten.ac.packet.wrapper.out.WPacketPlayOutEntityVelocity;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class VelocityHandler {
private APlayer player;
public void onPre(WPacketPlayOutEntityVelocity packet) {
if(packet.getEntityId() != player.getBukkitPlayer().getEntityId()) return;
}
}