@@ -20,6 +20,7 @@ package com.lambda.util.world.raycast
2020import com.lambda.Lambda.mc
2121import com.lambda.context.SafeContext
2222import com.lambda.interaction.managers.rotating.Rotation
23+ import com.lambda.util.BlockUtils.fluids
2324import com.lambda.util.math.distSq
2425import net.minecraft.client.network.ClientPlayerEntity
2526import net.minecraft.entity.Entity
@@ -42,16 +43,16 @@ object RayCastUtils {
4243 direction : Vec3d ,
4344 reach : Double ,
4445 mask : InteractionMask ,
45- fluids : Boolean = false,
46+ shapeType : RaycastContext .ShapeType = RaycastContext .ShapeType .OUTLINE ,
47+ fluidHandling : RaycastContext .FluidHandling = RaycastContext .FluidHandling .NONE ,
4648 ): HitResult ? {
4749 val vec = direction.multiply(reach)
4850 val point = start.add(vec)
4951
5052 val block = run {
5153 if (! mask.block) return @run null
5254
53- val fluidHandling = if (fluids) RaycastContext .FluidHandling .ANY else RaycastContext .FluidHandling .NONE
54- val context = RaycastContext (start, point, RaycastContext .ShapeType .OUTLINE , fluidHandling, player)
55+ val context = RaycastContext (start, point, shapeType, fluidHandling, player)
5556 val result = world.raycast(context)
5657
5758 result?.blockResult
@@ -72,7 +73,7 @@ object RayCastUtils {
7273 // ToDo: Should rather move player hitbox down and check collision
7374 fun SafeContext.distanceToGround (maxDist : Double = 100.0): Double {
7475 val pos = player.pos.add(0.0 , 0.1 , 0.0 )
75- val cast = Rotation .DOWN .rayCast(maxDist, pos, false , InteractionMask .Block ) ? : return maxDist
76+ val cast = Rotation .DOWN .rayCast(maxDist, pos, InteractionMask .Block ) ? : return maxDist
7677
7778 return max(0.0 , pos.y - cast.pos.y)
7879 }
0 commit comments