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
ConstructorDescriptionEntityCollisionResult
(@NotNull Point collisionPoint, @NotNull Entity entity, @NotNull Vec direction, double percentage) Creates an instance of aEntityCollisionResult
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull Point
Returns the value of thecollisionPoint
record component.int
compareTo
(@NotNull EntityCollisionResult o) @NotNull Vec
Returns the value of thedirection
record component.@NotNull Entity
entity()
Returns the value of theentity
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.double
Returns the value of thepercentage
record component.final String
toString()
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 aEntityCollisionResult
record class.- Parameters:
collisionPoint
- the value for thecollisionPoint
record componententity
- the value for theentity
record componentdirection
- the value for thedirection
record componentpercentage
- the value for thepercentage
record component
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in 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 thecollisionPoint
record component.- Returns:
- the value of the
collisionPoint
record component
-
entity
Returns the value of theentity
record component.- Returns:
- the value of the
entity
record component
-
direction
Returns the value of thedirection
record component.- Returns:
- the value of the
direction
record component
-
percentage
public double percentage()Returns the value of thepercentage
record component.- Returns:
- the value of the
percentage
record component
-