java.lang.Object
me.deecaad.weaponmechanics.weapon.explode.raytrace.Ray

public class Ray extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Ray(org.bukkit.Location origin, org.bukkit.util.Vector direction)
    Draws a ray from the given point origin in the direction direction.
    Ray(org.bukkit.World world, org.bukkit.util.Vector start, org.bukkit.util.Vector stop)
    Draws a ray between the 2 given points in the given world
    Ray(org.bukkit.World world, org.bukkit.util.Vector origin, org.bukkit.util.Vector end, double directionLength)
    A more "raw" constructor if you already have the direction's length.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<org.bukkit.entity.Entity,me.deecaad.core.compatibility.HitBox>
     
    trace(TraceCollision collision, double accuracy)
    Traces along this ray, colliding with block(s) and/or entity(s), depending on the given collision.
    trace(TraceCollision collision, double accuracy, boolean isShow)
    Traces along this ray, colliding with block(s) and/or entity(s), depending on the given collision.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Ray

      public Ray(@NotNull org.bukkit.Location origin, @NotNull org.bukkit.util.Vector direction)
      Draws a ray from the given point origin in the direction direction. Used the magnitude of direction to determine how far to trace.
      Parameters:
      origin - The starting point of this ray
      direction - The direction and magnitude to trace
    • Ray

      public Ray(@NotNull org.bukkit.World world, org.bukkit.util.Vector start, org.bukkit.util.Vector stop)
      Draws a ray between the 2 given points in the given world
      Parameters:
      world - The world in which the ray exists
      start - The starting point
      stop - The ending point
    • Ray

      public Ray(org.bukkit.World world, org.bukkit.util.Vector origin, org.bukkit.util.Vector end, double directionLength)
      A more "raw" constructor if you already have the direction's length. Draws a ray between the 2 given points in the given world.

      If you do not have the distance between the 2 points saved, you shouldn't use this constructor

      Parameters:
      world - The world in which the ray exists
      origin - The starting point
      end - The ending point
      directionLength - The distance between the 2 points
      See Also:
  • Method Details

    • trace

      public TraceResult trace(@NotNull TraceCollision collision, @Nonnegative double accuracy)
      Traces along this ray, colliding with block(s) and/or entity(s), depending on the given collision.
      Parameters:
      collision - What the ray collides with
      accuracy - The distance (in blocks) between checks
      Returns:
      The collision data
    • trace

      public TraceResult trace(@NotNull TraceCollision collision, @Nonnegative double accuracy, boolean isShow)
      Traces along this ray, colliding with block(s) and/or entity(s), depending on the given collision.
      Parameters:
      collision - What the ray collides with
      accuracy - The distance (in blocks) between checks
      isShow - Useful for debugging. Spawns redstone particles that are removed after 1 minute
      Returns:
      The collision data
    • getEntities

      public Map<org.bukkit.entity.Entity,me.deecaad.core.compatibility.HitBox> getEntities(TraceCollision collision)