Class RayTraceResult

java.lang.Object
org.bukkit.util.RayTraceResult

public class RayTraceResult extends Object
The hit result of a ray trace.

Only the hit position is guaranteed to always be available. The availability of the other attributes depends on what got hit and on the context in which the ray trace was performed.

Since:
1.13.2
  • Constructor Details

  • Method Details

    • getHitPosition

      @NotNull public @NotNull Vector getHitPosition()
      Gets the exact position of the hit.
      Returns:
      a copy of the exact hit position
      Since:
      1.13.2
    • getHitBlock

      @Nullable public @Nullable Block getHitBlock()
      Gets the hit block.
      Returns:
      the hit block, or null if not available
      Since:
      1.13.2
    • getHitBlockFace

      @Nullable public @Nullable BlockFace getHitBlockFace()
      Gets the hit block face.
      Returns:
      the hit block face, or null if not available
      Since:
      1.13.2
    • getHitEntity

      @Nullable public @Nullable Entity getHitEntity()
      Gets the hit entity.
      Returns:
      the hit entity, or null if not available
      Since:
      1.13.2
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object