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