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 withhasCollision- if the entity collidedres- sweep result of the collisioncached- if the result was due to quickly exiting
@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, boolean cached)
extends Record
The result of a physics simulation.
-
Constructor Summary
ConstructorsConstructorDescriptionPhysicsResult(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, boolean cached) Creates an instance of aPhysicsResultrecord class.PhysicsResult(Pos newPosition, Vec newVelocity, boolean isOnGround, boolean collisionX, boolean collisionY, boolean collisionZ, Vec originalDelta, Point[] collisionPoints, Shape[] collisionShapes, Point[] collisionShapePositions, boolean hasCollision, SweepResult res) -
Method Summary
Modifier and TypeMethodDescriptionbooleancached()Returns the value of thecachedrecord component.Returns the value of thecollisionPointsrecord component.Returns the value of thecollisionShapePositionsrecord component.Returns the value of thecollisionShapesrecord component.booleanReturns the value of thecollisionXrecord component.booleanReturns the value of thecollisionYrecord component.booleanReturns the value of thecollisionZrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of thehasCollisionrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisOnGroundrecord component.Returns the value of thenewPositionrecord component.Returns the value of thenewVelocityrecord component.Returns the value of theoriginalDeltarecord component.res()Returns the value of theresrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PhysicsResult
-
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, boolean cached) Creates an instance of aPhysicsResultrecord class.- Parameters:
newPosition- the value for thenewPositionrecord componentnewVelocity- the value for thenewVelocityrecord componentisOnGround- the value for theisOnGroundrecord componentcollisionX- the value for thecollisionXrecord componentcollisionY- the value for thecollisionYrecord componentcollisionZ- the value for thecollisionZrecord componentoriginalDelta- the value for theoriginalDeltarecord componentcollisionPoints- the value for thecollisionPointsrecord componentcollisionShapes- the value for thecollisionShapesrecord componentcollisionShapePositions- the value for thecollisionShapePositionsrecord componenthasCollision- the value for thehasCollisionrecord componentres- the value for theresrecord componentcached- the value for thecachedrecord component
-
-
Method Details
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
newPosition
Returns the value of thenewPositionrecord component.- Returns:
- the value of the
newPositionrecord component
-
newVelocity
Returns the value of thenewVelocityrecord component.- Returns:
- the value of the
newVelocityrecord component
-
isOnGround
public boolean isOnGround()Returns the value of theisOnGroundrecord component.- Returns:
- the value of the
isOnGroundrecord component
-
collisionX
public boolean collisionX()Returns the value of thecollisionXrecord component.- Returns:
- the value of the
collisionXrecord component
-
collisionY
public boolean collisionY()Returns the value of thecollisionYrecord component.- Returns:
- the value of the
collisionYrecord component
-
collisionZ
public boolean collisionZ()Returns the value of thecollisionZrecord component.- Returns:
- the value of the
collisionZrecord component
-
originalDelta
Returns the value of theoriginalDeltarecord component.- Returns:
- the value of the
originalDeltarecord component
-
collisionPoints
Returns the value of thecollisionPointsrecord component.- Returns:
- the value of the
collisionPointsrecord component
-
collisionShapes
Returns the value of thecollisionShapesrecord component.- Returns:
- the value of the
collisionShapesrecord component
-
collisionShapePositions
Returns the value of thecollisionShapePositionsrecord component.- Returns:
- the value of the
collisionShapePositionsrecord component
-
hasCollision
public boolean hasCollision()Returns the value of thehasCollisionrecord component.- Returns:
- the value of the
hasCollisionrecord component
-
res
-
cached
-