Skip to content

Commit

Permalink
fixing reach false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
funkemunky committed Sep 10, 2020
1 parent 5157ecd commit 2090f48
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<EntityType> allowedEntityTypes = Arrays
Expand All @@ -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<SimpleCollisionBox> 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) {
Expand All @@ -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);
}
Expand Down

0 comments on commit 2090f48

Please sign in to comment.