Class FollowerHistory

java.lang.Object
ac.boar.anticheat.prediction.vehicle.FollowerHistory

public final class FollowerHistory extends Object
Boar's best guess of where the client shows a vehicle the server moves: one pose, not a set. It copies the client's interpolation (PredictedMovementComponent, HistoryCache::addHistory, tickNextPosition, Actor::lerpTo), with one guessed stamp per packet (from LatencyUtil).

Used for the seat of a rider the server moves (FollowVehicleTicker), the box of a boat someone else drives (CompensatedWorldImpl), and the start pose when the player takes control of a boat (EntityCache). Checks that need a limit use FollowerEnvelope (envelope()).

Timing copies: when a stamp has two likely values, the history splits into copies that use the other value. Only the stationary death-exit check (admitsStationaryExitPose) reads them. They never change the main history.

  • Constructor Details

    • FollowerHistory

      public FollowerHistory(long nowNs, float x, float y, float z, float pitch, float yaw, FollowerHistory.ArrivalClock arrivalClock)
  • Method Details

    • envelope

      public FollowerEnvelope envelope()
    • envelopeControlSet

      public PositionSet envelopeControlSet()
    • envelopeControlYawOffsets

      public float[] envelopeControlYawOffsets()
    • envelopeControlTrusted

      public boolean envelopeControlTrusted()
    • controlEndTick

      public long controlEndTick()
    • addMove

      public void addMove(long handleNs, long earlyHandleNs, long group, long sentNs, long replyNs, float x, float y, float z, float pitch, float yaw, boolean onGround, boolean addedActor)
    • addMotion

      public void addMotion(long handleNs, long earlyHandleNs, long group, long sentNs, long replyNs, boolean onGround)
    • isLocallyPredicted

      public boolean isLocallyPredicted()
    • resetForLocalControl

      public void resetForLocalControl(long nowNs, long nowLowerNs, long tick, float x, float y, float z, float pitch, float yaw)
    • currentPose

      public FollowerHistory.ActorPose currentPose(float headYaw, boolean onGround)
    • hasPositionStep

      public boolean hasPositionStep()
    • advanceForControl

      public FollowerHistory.ControlAdvance advanceForControl(float headYaw, boolean onGround)
    • resumeRemoteTick

      public void resumeRemoteTick(long nowNs, long nowLowerNs, long tick, FollowerHistory.ActorPose before, FollowerHistory.ActorPose after, FollowerHistory.ActorPose pendingTarget, int pendingSteps)
    • tick

      public void tick(long nowNs, long nowLowerNs, long tick)
    • tickedLast

      public boolean tickedLast(long tick)
    • hasTicked

      public boolean hasTicked()
    • tickedAt

      public boolean tickedAt(long tick)
    • resync

      public void resync(long nowNs, long nowLowerNs)
    • distanceSquared

      public float distanceSquared(float x, float y, float z)
    • latestMoveDistanceSquared

      public float latestMoveDistanceSquared(float x, float y, float z)
    • stepAngle

      public static float stepAngle(float current, float target, int steps)
      One interpolation step of an angle in degrees, with steps the steps left (at least 1). The last step lands on the target. Otherwise the angle turns the short way by 1/steps of the gap (the client multiplies, it does not divide). The result is wrapped to -180..180. Also used for the rotation of an actor the reach interpolator moves (EntityCache.tickFollowerExternalRotation).
    • renderX

      public float renderX()
    • renderY

      public float renderY()
    • renderZ

      public float renderZ()
    • renderYaw

      public float renderYaw()
    • admitsStationaryExitPose

      public boolean admitsStationaryExitPose(float x, float y, float z, float yaw)
      True if one timing copy that is still alive (or this history, when there are no copies) shows the vehicle resting exactly at this pose.
    • untrustedClockReason

      public String untrustedClockReason()