mirror of
https://github.com/funkemunky/KauriV3.git
synced 2026-06-04 07:12:18 +00:00
Updating reach check for better accuracy and stability
This commit is contained in:
@@ -60,6 +60,7 @@ public class FlyA extends Check {
|
||||
&& !getPlayer().getBlockInformation().inWeb
|
||||
&& !getPlayer().getBlockInformation().inScaffolding
|
||||
&& !getPlayer().getBlockInformation().inLiquid
|
||||
&& !getPlayer().getBlockInformation().fenceBelow
|
||||
&& !getPlayer().getBlockInformation().onHalfBlock
|
||||
&& getPlayer().getInfo().getVelocity().isPassed(1)
|
||||
&& !getPlayer().getBlockInformation().onSlime && deltaPredict > 0.016) {
|
||||
|
||||
@@ -248,9 +248,9 @@ public class Horizontal extends Check {
|
||||
double pmotion = Math.hypot(pmotionx, pmotionz);
|
||||
|
||||
if (getPlayer().getMovement().getDeltaXZ() > pmotion
|
||||
&& smallestDelta > (getPlayer().getBlockInformation().onSoulSand ? 5E-4 : 5E-13)
|
||||
&& smallestDelta > (getPlayer().getBlockInformation().onSoulSand ? 0.01 : 5E-13)
|
||||
&& getPlayer().getMovement().getDeltaXZ() > 0.1) {
|
||||
if ((buffer += smallestDelta > 5E-4 ? 1 : 0.5) > 3) {
|
||||
if ((buffer += smallestDelta > 58E-4 ? 1 : 0.5) > 3) {
|
||||
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,
|
||||
getPlayer().getMovement().getTo().getLoc(), getPlayer().getMovement().getDeltaXZ());
|
||||
|
||||
@@ -12,10 +12,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -54,7 +51,6 @@ public class EntityLocationHandler {
|
||||
streak = 1;
|
||||
}
|
||||
|
||||
entityLocationMap.values().forEach(EntityLocation::interpolateLocation);
|
||||
lastFlying.reset();
|
||||
}
|
||||
|
||||
@@ -77,6 +73,12 @@ public class EntityLocationHandler {
|
||||
key -> new EntityLocation(entity));
|
||||
|
||||
runAction(entity, () -> {
|
||||
//Ensuring fully interpolated before clearing old locations
|
||||
while(eloc.increment > 0) {
|
||||
eloc.interpolateLocation();
|
||||
}
|
||||
eloc.oldLocations.addAll(eloc.interpolatedLocations);
|
||||
eloc.interpolateLocations();
|
||||
//We don't need to do version checking here. Atlas handles this for us.
|
||||
eloc.newX += packet.getX();
|
||||
eloc.newY += packet.getY();
|
||||
@@ -107,6 +109,12 @@ public class EntityLocationHandler {
|
||||
key -> new EntityLocation(entity));
|
||||
|
||||
runAction(entity, () -> {
|
||||
//Ensuring fully interpolated before clearing old locations
|
||||
while(eloc.increment > 0) {
|
||||
eloc.interpolateLocation();
|
||||
}
|
||||
eloc.oldLocations.addAll(eloc.interpolatedLocations);
|
||||
eloc.interpolateLocations();
|
||||
if(data.getPlayerVersion().isOrAbove(ProtocolVersion.V1_9)) {
|
||||
if (!(Math.abs(eloc.x - packet.getX()) >= 0.03125D)
|
||||
&& !(Math.abs(eloc.y - packet.getY()) >= 0.015625D)
|
||||
|
||||
@@ -18,11 +18,10 @@ public class EntityLocation {
|
||||
public boolean sentTeleport = false;
|
||||
public KLocation oldLocation, location;
|
||||
public List<KLocation> oldLocations = new EvictingList<>(3),
|
||||
interpolatedLocations = new EvictingList<>(3);
|
||||
interpolatedLocations = new EvictingList<>(4);
|
||||
|
||||
public void interpolateLocations() {
|
||||
increment = 3;
|
||||
interpolatedLocations.clear();
|
||||
while(increment > 0) {
|
||||
double d0 = x + (newX - x) / increment;
|
||||
double d1 = y + (newY - y) / increment;
|
||||
@@ -67,8 +66,6 @@ public class EntityLocation {
|
||||
}
|
||||
|
||||
public void interpolateLocation() {
|
||||
oldLocation = new KLocation(x, y, z, yaw, pitch);
|
||||
oldLocations.add(oldLocation);
|
||||
if(increment > 0) {
|
||||
double d0 = x + (newX - x) / increment;
|
||||
double d1 = y + (newY - y) / increment;
|
||||
|
||||
Reference in New Issue
Block a user