Skip to content

Commit 4d7df22

Browse files
committed
ref: raycast arguments
1 parent ac6054b commit 4d7df22

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

common/src/main/kotlin/com/lambda/interaction/rotation/Rotation.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ data class Rotation(val yaw: Double, val pitch: Double) {
4242

4343
fun equalFloat(other: Rotation): Boolean = yawF == other.yawF && pitchF == other.pitchF
4444

45+
/**
46+
* Returns the player's rotation vector
47+
* Same as [net.minecraft.entity.Entity.getRotationVec]
48+
*/
4549
val vector: Vec3d
4650
get() {
4751
val yawRad = -yaw.toRadian()

common/src/main/kotlin/com/lambda/util/world/raycast/RayCastUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ object RayCastUtils {
4040

4141
fun SafeContext.rayCast(
4242
start: Vec3d,
43-
end: Vec3d,
43+
rotation: Vec3d,
4444
reach: Double,
4545
mask: RayCastMask,
4646
fluids: Boolean = false,
4747
): HitResult? {
48-
val vec = end.multiply(reach)
48+
val vec = rotation.multiply(reach)
4949
val point = start.add(vec)
5050

5151
val block = run {

0 commit comments

Comments
 (0)