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 Details

    • EntityCollisionResult

      public EntityCollisionResult(@NotNull @NotNull Point collisionPoint, @NotNull @NotNull Entity entity, @NotNull @NotNull Vec direction, double percentage)
      Creates an instance of a EntityCollisionResult record class.
      Parameters:
      collisionPoint - the value for the collisionPoint record component
      entity - the value for the entity record component
      direction - the value for the direction record component
      percentage - the value for the percentage record component
  • Method Details

    • compareTo

      public int compareTo(@NotNull @NotNull EntityCollisionResult o)
      Specified by:
      compareTo in interface Comparable<EntityCollisionResult>
    • 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.
    • collisionPoint

      @NotNull public @NotNull Point collisionPoint()
      Returns the value of the collisionPoint record component.
      Returns:
      the value of the collisionPoint record component
    • entity

      @NotNull public @NotNull Entity entity()
      Returns the value of the entity record component.
      Returns:
      the value of the entity record component
    • direction

      @NotNull public @NotNull Vec direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • percentage

      public double percentage()
      Returns the value of the percentage record component.
      Returns:
      the value of the percentage record component