Record Class PhysicsResult

java.lang.Object
java.lang.Record
net.minestom.server.collision.PhysicsResult
Record Components:
newPosition - the new position of the entity
newVelocity - the new velocity of the entity
isOnGround - if the entity is on the ground
collisionX - if the entity collided on the X axis
collisionY - if the entity collided on the Y axis
collisionZ - if the entity collided on the Z axis
originalDelta - the velocity delta of the entity
collisionPoints - the points where the entity collided
collisionShapes - the shapes the entity collided with
collisionShapePositions - the positions of the shapes the entity collided with

@Experimental public record PhysicsResult(Pos newPosition, Vec newVelocity, boolean isOnGround, boolean collisionX, boolean collisionY, boolean collisionZ, Vec originalDelta, @UnknownNullability Point @UnknownNullability [] collisionPoints, @UnknownNullability Shape @UnknownNullability [] collisionShapes, @UnknownNullability Point @UnknownNullability [] collisionShapePositions, boolean hasCollision, SweepResult res) extends Record
The result of a physics simulation.
  • Constructor Details

    • PhysicsResult

      public PhysicsResult(Pos newPosition, Vec newVelocity, boolean isOnGround, boolean collisionX, boolean collisionY, boolean collisionZ, Vec originalDelta, @UnknownNullability Point @UnknownNullability [] collisionPoints, @UnknownNullability Shape @UnknownNullability [] collisionShapes, @UnknownNullability Point @UnknownNullability [] collisionShapePositions, boolean hasCollision, SweepResult res)
      Creates an instance of a PhysicsResult record class.
      Parameters:
      newPosition - the value for the newPosition record component
      newVelocity - the value for the newVelocity record component
      isOnGround - the value for the isOnGround record component
      collisionX - the value for the collisionX record component
      collisionY - the value for the collisionY record component
      collisionZ - the value for the collisionZ record component
      originalDelta - the value for the originalDelta record component
      collisionPoints - the value for the collisionPoints record component
      collisionShapes - the value for the collisionShapes record component
      collisionShapePositions - the value for the collisionShapePositions record component
      hasCollision - the value for the hasCollision record component
      res - the value for the res record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • newPosition

      public Pos newPosition()
      Returns the value of the newPosition record component.
      Returns:
      the value of the newPosition record component
    • newVelocity

      public Vec newVelocity()
      Returns the value of the newVelocity record component.
      Returns:
      the value of the newVelocity record component
    • isOnGround

      public boolean isOnGround()
      Returns the value of the isOnGround record component.
      Returns:
      the value of the isOnGround record component
    • collisionX

      public boolean collisionX()
      Returns the value of the collisionX record component.
      Returns:
      the value of the collisionX record component
    • collisionY

      public boolean collisionY()
      Returns the value of the collisionY record component.
      Returns:
      the value of the collisionY record component
    • collisionZ

      public boolean collisionZ()
      Returns the value of the collisionZ record component.
      Returns:
      the value of the collisionZ record component
    • originalDelta

      public Vec originalDelta()
      Returns the value of the originalDelta record component.
      Returns:
      the value of the originalDelta record component
    • collisionPoints

      public @UnknownNullability Point @UnknownNullability [] collisionPoints()
      Returns the value of the collisionPoints record component.
      Returns:
      the value of the collisionPoints record component
    • collisionShapes

      public @UnknownNullability Shape @UnknownNullability [] collisionShapes()
      Returns the value of the collisionShapes record component.
      Returns:
      the value of the collisionShapes record component
    • collisionShapePositions

      public @UnknownNullability Point @UnknownNullability [] collisionShapePositions()
      Returns the value of the collisionShapePositions record component.
      Returns:
      the value of the collisionShapePositions record component
    • hasCollision

      public boolean hasCollision()
      Returns the value of the hasCollision record component.
      Returns:
      the value of the hasCollision record component
    • res

      public SweepResult res()
      Returns the value of the res record component.
      Returns:
      the value of the res record component