From 2090f48540f7c82c0b27d168c11a568bda13cf19 Mon Sep 17 00:00:00 2001 From: Dawson Hessler Date: Thu, 10 Sep 2020 19:12:15 -0400 Subject: [PATCH] fixing reach false positive --- .../check/impl/combat/hitbox/ReachA.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java index 75a9667d2..8edd1e9ab 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/combat/hitbox/ReachA.java @@ -22,8 +22,6 @@ @Cancellable(cancelType = CancelType.ATTACK) public class ReachA extends Check { - private long lastUse; - private LivingEntity target; private double buffer; private static List allowedEntityTypes = Arrays @@ -35,16 +33,16 @@ public class ReachA extends Check { public void onFlying(WrappedInUseEntityPacket packet, long timeStamp) { if(data.playerInfo.creative || data.targetPastLocation.previousLocations.size() < 10 - || target == null - || !allowedEntityTypes.contains(target.getType())) return; + || packet.getAction() != WrappedInUseEntityPacket.EnumEntityUseAction.ATTACK + || !allowedEntityTypes.contains(packet.getEntity().getType())) return; List targetBoxes = data.targetPastLocation .getEstimatedLocation(timeStamp, (data.lagInfo.transPing + 3) * 50, 100L) - .stream().map(loc -> getHitbox(target, loc)).collect(Collectors.toList()); + .stream().map(loc -> getHitbox(packet.getEntity(), loc)).collect(Collectors.toList()); double distance = 69; - val bounds = getHitbox(target, new KLocation(0,0,0)); + val bounds = getHitbox(packet.getEntity(), new KLocation(0,0,0)); if(bounds == null) return; for (SimpleCollisionBox target : targetBoxes) { @@ -64,15 +62,6 @@ public void onFlying(WrappedInUseEntityPacket packet, long timeStamp) { debug("distance=%v.3 boxes=%v buffer=%v", distance, targetBoxes.size(), buffer); } - @Packet - public void onUse(WrappedInUseEntityPacket packet, long timeStamp) { - if (packet.getAction().equals(WrappedInUseEntityPacket.EnumEntityUseAction.ATTACK) - && packet.getEntity() instanceof LivingEntity) { - lastUse = timeStamp; - target = (LivingEntity) packet.getEntity(); - } - } - private static SimpleCollisionBox getHitbox(Entity entity, KLocation loc) { return (SimpleCollisionBox) EntityData.getEntityBox(loc, entity); }