Package net.minestom.server.collision
Record Class PhysicsResult
java.lang.Object
java.lang.Record
net.minestom.server.collision.PhysicsResult
- Record Components:
newPosition
- the new position of the entitynewVelocity
- the new velocity of the entityisOnGround
- if the entity is on the groundcollisionX
- if the entity collided on the X axiscollisionY
- if the entity collided on the Y axiscollisionZ
- if the entity collided on the Z axisoriginalDelta
- the velocity delta of the entitycollisionPoints
- the points where the entity collidedcollisionShapes
- the shapes the entity collided withcollisionShapePositions
- 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 Summary
ConstructorDescriptionPhysicsResult
(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 aPhysicsResult
record class. -
Method Summary
Modifier and TypeMethodDescription@UnknownNullability Point @UnknownNullability []
Returns the value of thecollisionPoints
record component.@UnknownNullability Point @UnknownNullability []
Returns the value of thecollisionShapePositions
record component.@UnknownNullability Shape @UnknownNullability []
Returns the value of thecollisionShapes
record component.boolean
Returns the value of thecollisionX
record component.boolean
Returns the value of thecollisionY
record component.boolean
Returns the value of thecollisionZ
record component.final boolean
Indicates whether some other object is "equal to" this one.boolean
Returns the value of thehasCollision
record component.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theisOnGround
record component.Returns the value of thenewPosition
record component.Returns the value of thenewVelocity
record component.Returns the value of theoriginalDelta
record component.res()
Returns the value of theres
record component.final String
toString()
Returns a string representation of this record class.
-
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 aPhysicsResult
record class.- Parameters:
newPosition
- the value for thenewPosition
record componentnewVelocity
- the value for thenewVelocity
record componentisOnGround
- the value for theisOnGround
record componentcollisionX
- the value for thecollisionX
record componentcollisionY
- the value for thecollisionY
record componentcollisionZ
- the value for thecollisionZ
record componentoriginalDelta
- the value for theoriginalDelta
record componentcollisionPoints
- the value for thecollisionPoints
record componentcollisionShapes
- the value for thecollisionShapes
record componentcollisionShapePositions
- the value for thecollisionShapePositions
record componenthasCollision
- the value for thehasCollision
record componentres
- the value for theres
record component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
newPosition
Returns the value of thenewPosition
record component.- Returns:
- the value of the
newPosition
record component
-
newVelocity
Returns the value of thenewVelocity
record component.- Returns:
- the value of the
newVelocity
record component
-
isOnGround
public boolean isOnGround()Returns the value of theisOnGround
record component.- Returns:
- the value of the
isOnGround
record component
-
collisionX
public boolean collisionX()Returns the value of thecollisionX
record component.- Returns:
- the value of the
collisionX
record component
-
collisionY
public boolean collisionY()Returns the value of thecollisionY
record component.- Returns:
- the value of the
collisionY
record component
-
collisionZ
public boolean collisionZ()Returns the value of thecollisionZ
record component.- Returns:
- the value of the
collisionZ
record component
-
originalDelta
Returns the value of theoriginalDelta
record component.- Returns:
- the value of the
originalDelta
record component
-
collisionPoints
Returns the value of thecollisionPoints
record component.- Returns:
- the value of the
collisionPoints
record component
-
collisionShapes
Returns the value of thecollisionShapes
record component.- Returns:
- the value of the
collisionShapes
record component
-
collisionShapePositions
Returns the value of thecollisionShapePositions
record component.- Returns:
- the value of the
collisionShapePositions
record component
-
hasCollision
public boolean hasCollision()Returns the value of thehasCollision
record component.- Returns:
- the value of the
hasCollision
record component
-
res
Returns the value of theres
record component.- Returns:
- the value of the
res
record component
-