public class RayTraceResult extends Object
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.
Constructor | Description |
---|---|
RayTraceResult(Vector hitPosition) |
Creates a RayTraceResult.
|
RayTraceResult(Vector hitPosition,
BlockFace hitBlockFace) |
Creates a RayTraceResult.
|
RayTraceResult(Vector hitPosition,
Block hitBlock,
BlockFace hitBlockFace) |
Creates a RayTraceResult.
|
RayTraceResult(Vector hitPosition,
Entity hitEntity) |
Creates a RayTraceResult.
|
RayTraceResult(Vector hitPosition,
Entity hitEntity,
BlockFace hitBlockFace) |
Creates a RayTraceResult.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
Block |
getHitBlock() |
Gets the hit block.
|
BlockFace |
getHitBlockFace() |
Gets the hit block face.
|
Entity |
getHitEntity() |
Gets the hit entity.
|
Vector |
getHitPosition() |
Gets the exact position of the hit.
|
int |
hashCode() |
|
String |
toString() |
public RayTraceResult(@NotNull Vector hitPosition)
hitPosition
- the hit positionpublic RayTraceResult(@NotNull Vector hitPosition, @Nullable BlockFace hitBlockFace)
hitPosition
- the hit positionhitBlockFace
- the hit block facepublic RayTraceResult(@NotNull Vector hitPosition, @Nullable Block hitBlock, @Nullable BlockFace hitBlockFace)
hitPosition
- the hit positionhitBlock
- the hit blockhitBlockFace
- the hit block facepublic RayTraceResult(@NotNull Vector hitPosition, @Nullable Entity hitEntity)
hitPosition
- the hit positionhitEntity
- the hit entity@NotNull public Vector getHitPosition()
@Nullable public Block getHitBlock()
null
if not available@Nullable public BlockFace getHitBlockFace()
null
if not available@Nullable public Entity getHitEntity()
null
if not availableCopyright © 2020. All rights reserved.