Package me.deecaad.core.utils.ray
Class RayTraceResult
java.lang.Object
me.deecaad.core.utils.ray.RayTraceResult
- Direct Known Subclasses:
BlockTraceResult,EntityTraceResult
-
Constructor Summary
ConstructorsConstructorDescriptionRayTraceResult(@NotNull org.bukkit.util.Vector origin, @NotNull org.bukkit.util.Vector direction, @NotNull HitBox hitBox, @NotNull org.bukkit.block.BlockFace hitFace, @NotNull org.bukkit.block.BlockFace exitFace, double hitMin, double hitMax) -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.block.BlockFaceReturns the exit face.@NotNull org.bukkit.util.VectorReturns the exact coordinates that the ray exits the hitbox, in world space.@NotNull HitBoxReturns the that hitbox that was hit.@NotNull org.bukkit.block.BlockFaceReturns the hit face.@NotNull org.bukkit.util.VectorReturns the exact coordinates that were hit, in world space.doubleReturns the distance between the origin and the furthest point of the hitbox.doubleReturns the distance between the origin of the ray and the hit location.doubleSame asgetHitMin(), except this method will always return a positive number.org.bukkit.entity.EntityDeprecated.doubleReturns the distance travelled through the hitbox.voidoutlineOnlyHitPosition(org.bukkit.entity.Entity player) toString()
-
Constructor Details
-
RayTraceResult
public RayTraceResult(@NotNull @NotNull org.bukkit.util.Vector origin, @NotNull @NotNull org.bukkit.util.Vector direction, @NotNull @NotNull HitBox hitBox, @NotNull @NotNull org.bukkit.block.BlockFace hitFace, @NotNull @NotNull org.bukkit.block.BlockFace exitFace, double hitMin, double hitMax)
-
-
Method Details
-
getHitBox
Returns the that hitbox that was hit.- Returns:
- The hitbox.
-
getHitFace
@NotNull public @NotNull org.bukkit.block.BlockFace getHitFace()Returns the hit face. Will be one of:BlockFace.NORTHBlockFace.EASTBlockFace.SOUTHBlockFace.WESTBlockFace.UPBlockFace.DOWN
Even when the raytrace starts within the hitbox, this will return the hit face as if it were "moved back" before ray tracing. This means that you might want to check
getHitMin()and check if it is negative.- Returns:
- The hit hitface.
-
getExitFace
@NotNull public @NotNull org.bukkit.block.BlockFace getExitFace()Returns the exit face. Will be one of:BlockFace.NORTHBlockFace.EASTBlockFace.SOUTHBlockFace.WESTBlockFace.UPBlockFace.DOWN
- Returns:
- The hit hitface.
-
getHitLocation
@NotNull public @NotNull org.bukkit.util.Vector getHitLocation()Returns the exact coordinates that were hit, in world space.- Returns:
- The hit location.
-
getExitLocation
@NotNull public @NotNull org.bukkit.util.Vector getExitLocation()Returns the exact coordinates that the ray exits the hitbox, in world space.- Returns:
- The exit location.
-
getHitMin
public double getHitMin()Returns the distance between the origin of the ray and the hit location. Will return a negative number if the ray spawned within the hitbox.- Returns:
- The entry wound of the ray hit.
-
getHitMinClamped
public double getHitMinClamped()Same asgetHitMin(), except this method will always return a positive number.- Returns:
- The entry wound of the ray hit (with 0 as a minimum bound).
-
getHitMax
public double getHitMax()Returns the distance between the origin and the furthest point of the hitbox.- Returns:
- The exit wound of the ray hit.
-
getThroughDistance
public double getThroughDistance()Returns the distance travelled through the hitbox. For a block, this number will not exceedsqrt(2). This method will always return a positive number.- Returns:
- The distance travelled through the hitbox.
-
outlineOnlyHitPosition
public void outlineOnlyHitPosition(org.bukkit.entity.Entity player) -
getLivingEntity
Deprecated. -
toString
-