Class RayCaster

java.lang.Object
dev.cerus.maps.raycast.RayCaster

public class RayCaster extends Object
Utility for casting rays

Used to detect objects in the Minecraft world

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Result of a ray cast operation
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    cast​(org.bukkit.Location pos, org.bukkit.util.Vector direction, double length, double multiplier, Function<org.bukkit.Location,​T> obstructionFunc, boolean collectPoints)
    Cast a ray

    Methods inherited from class java.lang.Object

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

    • RayCaster

      public RayCaster()
  • Method Details

    • cast

      public <T> RayCaster.Result<T> cast(org.bukkit.Location pos, org.bukkit.util.Vector direction, double length, double multiplier, Function<org.bukkit.Location,​T> obstructionFunc, boolean collectPoints)
      Cast a ray
      Type Parameters:
      T - The type of obstruction that we could encounter
      Parameters:
      pos - The starting position of the ray cast
      direction - The direction that the ray should head in
      length - The length that the ray should travel
      multiplier - The size of each step
      obstructionFunc - Function for detecting obstructions
      collectPoints - Whether we should keep track of each point we have travelled or not
      Returns:
      The result of this ray cast operation