Class Ray
java.lang.Object
me.deecaad.weaponmechanics.weapon.explode.raytrace.Ray
-
Constructor Summary
ConstructorsConstructorDescriptionRay(org.bukkit.Location origin, org.bukkit.util.Vector direction) Draws a ray from the given pointoriginin the directiondirection.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 givenworldRay(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 TypeMethodDescriptionMap<org.bukkit.entity.Entity, me.deecaad.core.compatibility.HitBox> getEntities(TraceCollision collision) trace(TraceCollision collision, double accuracy) Traces along this ray, colliding with block(s) and/or entity(s), depending on the givencollision.trace(TraceCollision collision, double accuracy, boolean isShow) Traces along this ray, colliding with block(s) and/or entity(s), depending on the givencollision.
-
Constructor Details
-
Ray
public Ray(@NotNull org.bukkit.Location origin, @NotNull org.bukkit.util.Vector direction) Draws a ray from the given pointoriginin the directiondirection. Used the magnitude ofdirectionto determine how far to trace.- Parameters:
origin- The starting point of this raydirection- 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 givenworld- Parameters:
world- The world in which the ray existsstart- The starting pointstop- 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 givenworld.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 existsorigin- The starting pointend- The ending pointdirectionLength- The distance between the 2 points- See Also:
-
-
Method Details
-
trace
Traces along this ray, colliding with block(s) and/or entity(s), depending on the givencollision.- Parameters:
collision- What the ray collides withaccuracy- 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 givencollision.- Parameters:
collision- What the ray collides withaccuracy- The distance (in blocks) between checksisShow- 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)
-