Class VRPoseHistoryImpl

java.lang.Object
net.timtaran.interactivemc.util.vr.VRPoseHistoryImpl
All Implemented Interfaces:
VRPoseHistory

public class VRPoseHistoryImpl extends Object implements VRPoseHistory
  • Field Summary

    Fields inherited from interface net.timtaran.interactivemc.util.vr.VRPoseHistory

    MAX_TICKS_BACK
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPose(VRPose pose, net.minecraft.world.phys.Vec3 playerPos)
     
    net.minecraft.world.phys.Vec3
    averageVelocity(PlayerBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative)
    Gets the average velocity in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    void
     
    Gets a raw list of VRPose instances, with index 0 representing the current tick's pose, 1 representing last tick's pose, etc.
    getHistoricalData(int ticksBack, boolean playerPositionRelative)
    Gets the pose from ticksBack ticks back, or null if such data isn't available.
    boolean
     
    net.minecraft.world.phys.Vec3
    netMovement(PlayerBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative)
    Gets the net movement between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
    int
    Gets the number of ticks, historical data is currently available for.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VRPoseHistoryImpl

      public VRPoseHistoryImpl()
  • Method Details

    • addPose

      public void addPose(VRPose pose, net.minecraft.world.phys.Vec3 playerPos)
    • clear

      public void clear()
    • isEmpty

      public boolean isEmpty()
    • ticksOfHistory

      public int ticksOfHistory()
      Description copied from interface: VRPoseHistory
      Gets the number of ticks, historical data is currently available for. The number returned by this method will never be higher than VRPoseHistory.MAX_TICKS_BACK, the maximum number of ticks this implementation holds data for, however, it can be lower than VRPoseHistory.MAX_TICKS_BACK.
      Specified by:
      ticksOfHistory in interface VRPoseHistory
      Returns:
      The number of ticks, historical data is currently available for.
    • getAllHistoricalData

      public List<VRPose> getAllHistoricalData()
      Description copied from interface: VRPoseHistory
      Gets a raw list of VRPose instances, with index 0 representing the current tick's pose, 1 representing last tick's pose, etc.
      Specified by:
      getAllHistoricalData in interface VRPoseHistory
      Returns:
      The aforementioned list of VRPose instances.
    • getHistoricalData

      public VRPose getHistoricalData(int ticksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Description copied from interface: VRPoseHistory
      Gets the pose from ticksBack ticks back, or null if such data isn't available.
      Specified by:
      getHistoricalData in interface VRPoseHistory
      Parameters:
      ticksBack - Ticks back to retrieve data from.
      playerPositionRelative - Whether to get the historical data with position relative to the player's position.
      Returns:
      A VRPose instance from ticksBack ticks ago, or null if that data isn't available.
      Throws:
      IllegalArgumentException - Thrown when ticksBack is outside the range [0,200].
    • netMovement

      public net.minecraft.world.phys.Vec3 netMovement(PlayerBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Description copied from interface: VRPoseHistory
      Gets the net movement between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Specified by:
      netMovement in interface VRPoseHistory
      Parameters:
      bodyPart - The body part to get the net movement for.
      maxTicksBack - The maximum number of ticks back to compare the most recent data with.
      playerPositionRelative - Whether net movement should be calculated relative to the player position.
      Returns:
      The aforementioned net movement. Note that this will return zero change on all axes if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.
    • averageVelocity

      public net.minecraft.world.phys.Vec3 averageVelocity(PlayerBodyPart bodyPart, int maxTicksBack, boolean playerPositionRelative) throws IllegalArgumentException
      Description copied from interface: VRPoseHistory
      Gets the average velocity in blocks/tick between the most recent VRPose in this instance and the oldest VRPose that can be retrieved, going no farther back than maxTicksBack.
      Specified by:
      averageVelocity in interface VRPoseHistory
      Parameters:
      bodyPart - The body part to get the average velocity for.
      maxTicksBack - The maximum number of ticks back to calculate velocity with.
      playerPositionRelative - Whether velocity should be calculated to the player position.
      Returns:
      The aforementioned average velocity on each axis. Note that this will return zero velocity on all axes if only zero ticks can be looked back. Will be null if the body part requested isn't available.
      Throws:
      IllegalArgumentException - Thrown when maxTicksBack is outside the range [0,200] or an invalid bodyPart is supplied.