Package net.minestom.server.collision
Record Class EntityCollisionResult
java.lang.Object
java.lang.Record
net.minestom.server.collision.EntityCollisionResult
- Record Components:
collisionPoint-entity-direction- the direction of the collision. ex. Vec(-1, 0, 0) means the entity collided with the west face of the entity
- All Implemented Interfaces:
Comparable<EntityCollisionResult>
public record EntityCollisionResult(@NotNull Point collisionPoint, @NotNull Entity entity, @NotNull Vec direction, double percentage)
extends Record
implements Comparable<EntityCollisionResult>
Represents the result of a collision with an entity
-
Constructor Summary
ConstructorsConstructorDescriptionEntityCollisionResult(@NotNull Point collisionPoint, @NotNull Entity entity, @NotNull Vec direction, double percentage) Creates an instance of aEntityCollisionResultrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull PointReturns the value of thecollisionPointrecord component.intcompareTo(@NotNull EntityCollisionResult o) @NotNull VecReturns the value of thedirectionrecord component.@NotNull Entityentity()Returns the value of theentityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleReturns the value of thepercentagerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EntityCollisionResult
public EntityCollisionResult(@NotNull @NotNull Point collisionPoint, @NotNull @NotNull Entity entity, @NotNull @NotNull Vec direction, double percentage) Creates an instance of aEntityCollisionResultrecord class.- Parameters:
collisionPoint- the value for thecollisionPointrecord componententity- the value for theentityrecord componentdirection- the value for thedirectionrecord componentpercentage- the value for thepercentagerecord component
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<EntityCollisionResult>
-
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 '=='. -
collisionPoint
Returns the value of thecollisionPointrecord component.- Returns:
- the value of the
collisionPointrecord component
-
entity
Returns the value of theentityrecord component.- Returns:
- the value of the
entityrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
percentage
public double percentage()Returns the value of thepercentagerecord component.- Returns:
- the value of the
percentagerecord component
-