isLookingAtEntity

fun isLookingAtEntity(toEntity: Entity, range: Double, rotation: Rotation): EntityHitResult?

Ray-traces from the current camera entity and returns a hit result when the traced entity equals toEntity.

Parameters

toEntity

target entity that must be hit by the ray.

range

maximum ray-trace distance.

rotation

yaw/pitch used to build the ray direction.


fun isLookingAtEntity(fromEntity: Entity = mc.cameraEntity!!, toEntity: Entity, rotation: Rotation, range: Double, throughWallsRange: Double): EntityHitResult?

Ray-traces from fromEntity and validates whether toEntity is hit with the given rotation.

Parameters

fromEntity

entity whose eye position is used as ray origin.

toEntity

target entity that must be hit by the ray.

rotation

yaw/pitch used to build the ray direction.

range

maximum non-wall-bypass distance.

throughWallsRange

distance that is allowed without line-of-sight.